| title | sp_grant_login_to_proxy (Transact-SQL) | ||
|---|---|---|---|
| description | sp_grant_login_to_proxy grants a security principal access to a proxy. | ||
| author | VanMSFT | ||
| ms.author | vanto | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server]
Grants a security principal access to a proxy.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_grant_login_to_proxy
[ [ @login_name = ] N'login_name' ]
[ , [ @fixed_server_role = ] N'fixed_server_role' ]
[ , [ @msdb_role = ] N'msdb_role' ]
[ , [ @proxy_id = ] proxy_id ]
[ , [ @proxy_name = ] N'proxy_name' ]
[ ; ]
The login name to grant access to. @login_name is nvarchar(256), with a default of NULL.
One of @login_name, @fixed_server_role, or @msdb_role must be specified, or the stored procedure fails.
The fixed server role to grant access to. @fixed_server_role is nvarchar(256), with a default of NULL.
One of @login_name, @fixed_server_role, or @msdb_role must be specified, or the stored procedure fails.
The database role in the msdb database to grant access to. @msdb_role is nvarchar(256), with a default of NULL.
One of @login_name, @fixed_server_role, or @msdb_role must be specified, or the stored procedure fails.
The identifier for the proxy to grant access for. @proxy_id is int, with a default of NULL.
One of @proxy_id or @proxy_name must be specified, or the stored procedure fails.
The name of the proxy to grant access for. @proxy_name is sysname, with a default of NULL.
One of @proxy_id or @proxy_name must be specified, or the stored procedure fails.
0 (success) or 1 (failure).
sp_grant_login_to_proxy must be run from the msdb database.
[!INCLUDE msdb-execute-permissions]
The following example allows the login adventure-works\terrid to use the proxy Catalog application proxy.
USE msdb;
GO
EXECUTE dbo.sp_grant_login_to_proxy
@login_name = N'adventure-works\terrid',
@proxy_name = N'Catalog application proxy';
GO