GRANT 证书权限 (Transact-SQL)GRANT Certificate Permissions (Transact-SQL)

适用对象:是SQL Server 是Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库APPLIES TO: yesSQL Server yesAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

授予对 SQL ServerSQL Server 中证书的权限。Grants permissions on a certificate in SQL ServerSQL Server.

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

语法Syntax

GRANT permission  [ ,...n ]    
    ON CERTIFICATE :: certificate_name   
    TO principal [ ,...n ] [ WITH GRANT OPTION ]   
    [ AS granting_principal ]   

参数Arguments

permission permission
指定可对证书授予的权限。Specifies a permission that can be granted on a certificate. 如下所列。Listed below.

ON CERTIFICATE ::certificate_name ON CERTIFICATE ::certificate_name
指定对其授予权限的证书。Specifies the certificate on which the permission is being granted. 需要使用作用域限定符“::”。The scope qualifier "::" is required.

database_principal database_principal
指定要向其授予权限的主体。Specifies the principal to which the permission is being granted. 可以是以下类型之一:One of the following:

  • 数据库用户database user
  • 数据库角色database role
  • 应用程序角色application role
  • 映射到 Windows 登录名的数据库用户database user mapped to a Windows login
  • 映射到 Windows 组的数据库用户database user mapped to a Windows group
  • 映射到证书的数据库用户database user mapped to a certificate
  • 映射到非对称密钥的数据库用户database user mapped to an asymmetric key
  • 未映射到服务器主体的数据库用户。database user not mapped to a server principal.

GRANT OPTIONGRANT OPTION
指示该主体还可以向其他主体授予所指定的权限。Indicates that the principal will also be given the ability to grant the specified permission to other principals.

AS granting_principal AS granting_principal
指定一个主体,执行该查询的主体从该主体获得授予该权限的权利。Specifies a principal from which the principal executing this query derives its right to grant the permission. 可以是以下类型之一:One of the following:

  • 数据库用户database user
  • 数据库角色database role
  • 应用程序角色application role
  • 映射到 Windows 登录名的数据库用户database user mapped to a Windows login
  • 映射到 Windows 组的数据库用户database user mapped to a Windows group
  • 映射到证书的数据库用户database user mapped to a certificate
  • 映射到非对称密钥的数据库用户database user mapped to an asymmetric key
  • 未映射到服务器主体的数据库用户。database user not mapped to a server principal.

RemarksRemarks

证书是一个数据库级的安全对象,包含于权限层次结构中作为其父级的数据库中。A certificate 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 certificate are listed below, together with the more general permissions that include them by implication.

证书权限Certificate permission 证书权限隐含的权限Implied by certificate permission 数据库权限隐含的权限Implied by database permission
CONTROLCONTROL CONTROLCONTROL CONTROLCONTROL
TAKE OWNERSHIPTAKE OWNERSHIP CONTROLCONTROL CONTROLCONTROL
ALTERALTER CONTROLCONTROL ALTER ANY CERTIFICATEALTER ANY CERTIFICATE
REFERENCESREFERENCES CONTROLCONTROL REFERENCESREFERENCES
VIEW DEFINITIONVIEW DEFINITION CONTROLCONTROL VIEW DEFINITIONVIEW DEFINITION

权限Permissions

授权者(或用 AS 选项指定的主体)必须具有带 GRANT OPTION 的相同权限,或具有隐含所授予权限的更高权限。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.

如果使用 AS 选项,还必须满足以下附加要求:If using the AS option, these additional requirements apply.

AS granting_principal AS granting_principal 所需的其他权限Additional permission required
数据库用户Database user 对用户的 IMPERSONATE 权限、db_securityadmin 固定数据库角色的成员身份、db_owner 固定数据库角色的成员身份或 sysadmin 固定服务器角色的成员身份 。IMPERSONATE 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.
映射到 Windows 登录名的数据库用户Database user mapped to a Windows login 对用户的 IMPERSONATE 权限、db_securityadmin 固定数据库角色的成员身份、db_owner 固定数据库角色的成员身份或 sysadmin 固定服务器角色的成员身份 。IMPERSONATE 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.
映射到 Windows 组的数据库用户Database user mapped to a Windows group Windows 组的成员身份、db_securityadmin 固定数据库角色的成员身份、db_owner 固定数据库角色的成员身份或 sysadmin 固定服务器角色的成员身份 。Membership 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 certificate db_securityadmin 固定数据库角色的成员身份、db_owner 固定数据库角色的成员身份或 sysadmin 固定服务器角色的成员身份 。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 an asymmetric key db_securityadmin 固定数据库角色的成员身份、db_owner 固定数据库角色的成员身份或 sysadmin 固定服务器角色的成员身份 。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 not mapped to any server principal 对用户的 IMPERSONATE 权限、db_securityadmin 固定数据库角色的成员身份、db_owner 固定数据库角色的成员身份或 sysadmin 固定服务器角色的成员身份 。IMPERSONATE 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 role 对角色的 ALTER 权限、db_securityadmin 固定数据库角色的成员身份、db_owner 固定数据库角色的成员身份或 sysadmin 固定服务器角色的成员身份 。ALTER 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 role 对角色的 ALTER 权限、db_securityadmin 固定数据库角色的成员身份、db_owner 固定数据库角色的成员身份或 sysadmin 固定服务器角色的成员身份 。ALTER 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.

对象所有者可以授予对其所拥有的对象的权限。Object owners can grant permissions on the objects they own. 对某安全对象具有 CONTROL 权限的主体可以授予对该安全对象的权限。Principals with CONTROL permission on a securable can grant permission on that securable.

被授予 CONTROL SERVER 权限的用户(例如,sysadmin 固定服务器角色的成员)可以授予对相应服务器中任一个安全对象的任意权限 。Grantees of CONTROL SERVER permission, such as members of the sysadmin fixed server role, can grant any permission on any securable in the server. 将某一数据库的 CONTROL 权限授予用户(例如,db_owner 固定数据库角色的成员)后,该用户就可授予对该数据库中任何一个安全对象的任意权限 。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. 被授权 CONTROL 权限的用户可以授予对相应架构中任一个对象的任意权限。Grantees of CONTROL permission on a schema can grant any permission on any object within the schema.

另请参阅See Also

GRANT (Transact-SQL) GRANT (Transact-SQL)
权限(数据库引擎) Permissions (Database Engine)
主体(数据库引擎) Principals (Database Engine)
CREATE CERTIFICATE (Transact-SQL) CREATE CERTIFICATE (Transact-SQL)
CREATE ASYMMETRIC KEY (Transact-SQL) CREATE ASYMMETRIC KEY (Transact-SQL)
CREATE APPLICATION ROLE (Transact-SQL) CREATE APPLICATION ROLE (Transact-SQL)
加密层次结构Encryption Hierarchy