title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.subservice | ms.topic | f1_keywords | helpviewer_keywords | dev_langs | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sp_add_proxy (Transact-SQL) |
Adds the specified SQL Server Agent proxy. |
markingmyname |
maghan |
randolphwest |
08/21/2024 |
sql |
system-objects |
reference |
|
|
|
[!INCLUDE SQL Server]
Adds the specified [!INCLUDE ssNoVersion] Agent proxy.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_add_proxy
[ @proxy_name = ] 'proxy_name'
, [ @enabled = ] is_enabled
, [ @description = ] 'description'
, [ @credential_name = ] 'credential_name'
, [ @credential_id = ] credential_id
, [ @proxy_id = ] id OUTPUT
[ ; ]
The name of the proxy to create. The @proxy_name is sysname, with a default of NULL
. When the @proxy_name is NULL
or an empty string, the name of the proxy defaults to the @credential_name or @credential_id supplied.
Specifies whether the proxy is enabled. The @enabled flag is tinyint, with a default of 1
. When @enabled is 0
, the proxy isn't enabled, and can't be used by a job step.
A description of the proxy. The description is nvarchar(512), with a default of NULL
. The description allows you to document the proxy, but isn't otherwise used by [!INCLUDE ssNoVersion] Agent. Therefore, this argument is optional.
The name of the credential for the proxy. The @credential_name is sysname, with a default of NULL
. Either @credential_name or @credential_id must be specified.
The identification number of the credential for the proxy. The @credential_id is int, with a default of NULL
. Either @credential_name or @credential_id must be specified.
The proxy identification number assigned to the proxy if created successfully.
0
(success) or 1
(failure).
None.
This stored procedure must be run in the msdb
database.
A [!INCLUDE ssNoVersion] Agent proxy manages security for job steps that involve subsystems other than the [!INCLUDE tsql] subsystem. Each proxy corresponds to a security credential. A proxy might have access to any number of subsystems.
[!INCLUDE msdb-execute-permissions]
Members of the sysadmin fixed security role can create job steps that use any proxy. Use the stored procedure sp_grant_login_to_proxy to grant other logins access to the proxy.
This example creates a proxy for the credential CatalogApplicationCredential
. The code assumes that the credential already exists. For more information about credentials, see CREATE CREDENTIAL.
USE msdb;
GO
EXEC dbo.sp_add_proxy
@proxy_name = 'Catalog application proxy',
@enabled = 1,
@description = 'Maintenance tasks on catalog application.',
@credential_name = 'CatalogApplicationCredential';
GO