sp_xp_cmdshell_proxy_account (Transact-SQL)

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)yesAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Creates a proxy credential for xp_cmdshell.

Note

xp_cmdshell is disabled by default. To enable xp_cmdshell, see xp_cmdshell Server Configuration Option.

||
|-|
|Applies to: SQL Server ( SQL Server 2008 through current version), Azure SQL Database.|

Topic link icon Transact-SQL Syntax Conventions

Syntax


sp_xp_cmdshell_proxy_account [ NULL | { 'account_name' , 'password' } ]  

Arguments

NULL
Specifies that the proxy credential should be deleted.

account_name
Specifies a Windows login that will be the proxy.

password
Specifies the password of the Windows account.

Return Code Values

0 (success) or 1 (failure)

Remarks

The proxy credential will be called ##xp_cmdshell_proxy_account##.

When it is executed using the NULL option, sp_xp_cmdshell_proxy_account deletes the proxy credential.

Permissions

Requires CONTROL SERVER permission.

Examples

A. Creating the proxy credential

The following example shows how to create a proxy credential for a Windows account called ADVWKS\Max04 with password ds35efg##65.

EXEC sp_xp_cmdshell_proxy_account 'ADVWKS\Max04', 'ds35efg##65';  
GO  

B. Dropping the proxy credential

The following example removes the proxy credential from the credential store.

EXEC sp_xp_cmdshell_proxy_account NULL;  
GO  

See Also

xp_cmdshell (Transact-SQL)
CREATE CREDENTIAL (Transact-SQL)
sys.credentials (Transact-SQL)
System Stored Procedures (Transact-SQL)
Security Stored Procedures (Transact-SQL)