GRANT Symmetric Key Permissions (Transact-SQL)

 

Updated: June 10, 2016

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

Grants permissions on a symmetric key.

Topic link icon Transact-SQL Syntax Conventions

  
GRANT permission [ ,...n ]    
    ON SYMMETRIC KEY :: symmetric_key_name   
    TO <database_principal> [ ,...n ] [ WITH GRANT OPTION ]  
        [ AS <database_principal> ]   
  
<database_principal> ::=   
        Database_user   
    | Database_role   
    | Application_role   
    | Database_user_mapped_to_Windows_User   
    | Database_user_mapped_to_Windows_Group   
    | Database_user_mapped_to_certificate   
    | Database_user_mapped_to_asymmetric_key   
    | Database_user_with_no_login   

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

ON SYMMETRIC KEY ::asymmetric_key_name
Specifies the symmetric key on which the permission is being granted. The scope qualifier (::) is required.

TO <database_principal>
Specifies the principal to which the permission is being granted.

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

AS <database_principal>
Specifies a principal from which the principal executing this query derives its right to grant the permission.

Database_user
Specifies a database user.

Database_role
Specifies a database role.

Application_role
Specifies an application role.

Database_user_mapped_to_Windows_User
Specifies a database user mapped to a Windows user.

Database_user_mapped_to_Windows_Group
Specifies a database user mapped to a Windows group.

Database_user_mapped_to_certificate
Specifies a database user mapped to a certificate.

Database_user_mapped_to_asymmetric_key
Specifies a database user mapped to an asymmetric key.

Database_user_with_no_login
Specifies a database user with no corresponding server-level principal.

Information about symmetric keys is visible in the sys.symmetric_keys catalog view.

A symmetric key is a database-level securable contained by the database that is its parent in the permissions hierarchy. The most specific and limited permissions that can be granted on a symmetric key are listed in the following table, together with the more general permissions that include them by implication.

Symmetric key permissionImplied by symmetric key permissionImplied by database permission
ALTERCONTROLALTER ANY SYMMETRIC KEY
CONTROLCONTROLCONTROL
REFERENCESCONTROLREFERENCES
TAKE OWNERSHIPCONTROLCONTROL
VIEW DEFINITIONCONTROLVIEW DEFINITION

The grantor (or the principal specified with the AS option) must have either the permission itself with GRANT OPTION, or a higher permission that implies the permission being granted.

If you are using the AS option, the following additional requirements apply.

AS granting_principalAdditional permission required
Database userIMPERSONATE permission on the user, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.
Database user mapped to a Windows loginIMPERSONATE permission on the user, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.
Database user mapped to a Windows groupMembership in the Windows group, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.
Database user mapped to a certificateMembership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.
Database user mapped to an asymmetric keyMembership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.
Database user not mapped to any server principalIMPERSONATE permission on the user, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.
Database roleALTER permission on the role, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.
Application roleALTER permission on the role, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.

Principals with CONTROL permission on a securable can grant permission on that securable.

Grantees of CONTROL SERVER permission, such as members of the sysadmin fixed server role, can grant any permission on any securable in the server. Grantees of CONTROL permission on a database, such as members of the db_owner fixed database role, can grant any permission on any securable in the database.

The following example grants ALTER permission on the symmetric key SamInventory42 to the database user HamidS.

USE AdventureWorks2012;  
GRANT ALTER ON SYMMETRIC KEY::SamInventory42 TO HamidS;  
GO  

sys.symmetric_keys (Transact-SQL)
DENY Symmetric Key Permissions (Transact-SQL)
REVOKE Symmetric Key Permissions (Transact-SQL)
CREATE SYMMETRIC KEY (Transact-SQL)
Permissions (Database Engine)
Principals (Database Engine)
Encryption Hierarchy

Community Additions

ADD
Show: