| title | sp_xp_cmdshell_proxy_account (Transact-SQL) | ||
|---|---|---|---|
| description | Creates a proxy credential for xp_cmdshell. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
||
| monikerRange | =azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current |
[!INCLUDE SQL Server SQL Database]
Creates a proxy credential for xp_cmdshell.
Note
xp_cmdshell is disabled by default. To enable xp_cmdshell, see xp_cmdshell (server configuration option).
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_xp_cmdshell_proxy_account [ NULL | { 'account_name' , 'password' } ]
[ ; ]
[!INCLUDE extended-stored-procedures]
Specifies that the proxy credential should be deleted.
Specifies the Windows account to be the proxy.
Specifies the password of the Windows account.
0 (success) or 1 (failure).
The proxy credential is called ##xp_cmdshell_proxy_account##.
When it's executed using the NULL option, sp_xp_cmdshell_proxy_account deletes the proxy credential.
Requires CONTROL SERVER permission.
The following example shows how to create a proxy credential for a Windows account called ADVWKS\Max04. Replace <password> with a strong password.
EXECUTE sp_xp_cmdshell_proxy_account 'ADVWKS\Max04', '<password>';
GOThe following example removes the proxy credential from the credential store.
EXECUTE sp_xp_cmdshell_proxy_account NULL;
GO