sp_xp_cmdshell_proxy_account (Transact-SQL)sp_xp_cmdshell_proxy_account (Transact-SQL)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database

xp_cmdshell 创建代理凭据。Creates a proxy credential for xp_cmdshell.

备注

默认情况下,禁用 xp_cmdshellxp_cmdshell is disabled by default. 若要启用 xp_cmdshell,请参阅 Xp_cmdshell 服务器配置选项To enable xp_cmdshell, see xp_cmdshell Server Configuration Option.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

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

参数Arguments

NullNULL
指定应删除的代理凭据。Specifies that the proxy credential should be deleted.

account_nameaccount_name
指定要成为代理的 Windows 登录名。Specifies a Windows login that will be the proxy.

passwordpassword
指定 Windows 帐户的密码。Specifies the password of the Windows account.

返回代码值Return Code Values

0(成功)或 1(失败)0 (success) or 1 (failure)

备注Remarks

代理凭据将称为 # #xp_cmdshell_proxy_account # #The proxy credential will be called ##xp_cmdshell_proxy_account##.

当使用 NULL 选项执行时, sp_xp_cmdshell_proxy_account 会删除代理凭据。When it is executed using the NULL option, sp_xp_cmdshell_proxy_account deletes the proxy credential.

权限Permissions

需要 CONTROL SERVER 权限。Requires CONTROL SERVER permission.

示例Examples

A.A. 创建代理凭据Creating the proxy credential

以下示例显示如何使用密码 ADVWKS\Max04 为 Windows 帐户创建名为 ds35efg##65 的代理凭据。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.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) xp_cmdshell (Transact-SQL)
CREATE CREDENTIAL (Transact-SQL) CREATE CREDENTIAL (Transact-SQL)
sys.credentials (Transact-SQL) sys.credentials (Transact-SQL)
系统存储过程 (Transact-SQL) System Stored Procedures (Transact-SQL)
安全存储过程 (Transact-SQL)Security Stored Procedures (Transact-SQL)