Bagikan melalui


GRANT Endpoint Permissions (Transact-SQL)

Grants permissions on an endpoint.

Topic link icon Transact-SQL Syntax Conventions

Syntax

GRANT permission  [ ,...n ] ON ENDPOINT :: endpoint_name
        TO < server_principal >  [ ,...n ]
    [ WITH GRANT OPTION ]
    [ AS SQL_Server_login ] 

<server_principal> ::=  
        SQL_Server_login
    | SQL_Server_login_from_Windows_login 
    | SQL_Server_login_from_certificate 
    | SQL_Server_login_from_AsymKey

Arguments

  • permission
    Specifies a permission that can be granted on an endpoint. For a list of the permissions, see the Remarks section later in this topic.

  • ON ENDPOINT ::endpoint_name
    Specifies the endpoint on which the permission is being granted. The scope qualifier (
    ::
    ) is required.

  • TO <server_principal>
    Specifies the SQL Server login to which the permission is being granted.

  • SQL_Server_login
    Specifies the name of a SQL Server login.

  • SQL_Server_login_from_Windows_login
    Specifies the name of a SQL Server login created from a Windows login.

  • SQL_Server_login_from_certificate
    Specifies the name of a SQL Server login mapped to a certificate.

  • SQL_Server_login_from_AsymKey
    Specifies the name of a SQL Server login mapped to an asymmetric key.

  • WITH GRANT OPTION
    Indicates that the principal will also be given the ability to grant the specified permission to other principals.

  • AS SQL_Server_login
    Specifies the SQL Server login from which the principal executing this query derives its right to grant the permission.

Remarks

Permissions at the server scope can be granted only when the current database is master.

Information about endpoints is visible in the sys.endpoints catalog view. Information about server permissions is visible in the sys.server_permissions catalog view, and information about server principals is visible in the sys.server_principals catalog view.

An endpoint is a server-level securable. The most specific and limited permissions that can be granted on an endpoint are listed in the following table, together with the more general permissions that include them by implication.

Endpoint permission

Implied by endpoint permission

Implied by server permission

ALTER

CONTROL

ALTER ANY ENDPOINT

CONNECT

CONTROL

CONTROL SERVER

CONTROL

CONTROL

CONTROL SERVER

TAKE OWNERSHIP

CONTROL

CONTROL SERVER

VIEW DEFINITION

CONTROL

VIEW ANY DEFINITION

Permissions

Requires CONTROL permission on the endpoint or ALTER ANY ENDPOINT permission on the server.

Examples

A. Granting VIEW DEFINITION permission on an endpoint

The following example grants VIEW DEFINITION permission on endpoint Mirror7 to SQL Server login ZArifin.

USE master;
GRANT VIEW DEFINITION ON ENDPOINT::Mirror7 TO ZArifin;
GO

B. Granting TAKE OWNERSHIP permission with the GRANT OPTION

The following example grants TAKE OWNERSHIP permission on endpoint Shipping83 to SQL Server user PKomosinski with the GRANT OPTION.

USE master;
GRANT TAKE OWNERSHIP ON ENDPOINT::Shipping83 TO PKomosinski 
    WITH GRANT OPTION;
GO

See Also

Reference

DENY Endpoint Permissions (Transact-SQL)

REVOKE Endpoint Permissions (Transact-SQL)

CREATE ENDPOINT (Transact-SQL)

Endpoints Catalog Views (Transact-SQL)

sys.endpoints (Transact-SQL)

Concepts

Permissions (Database Engine)

Principals (Database Engine)