你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Server Keys - Create Or Update

创建或更新服务器密钥。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}?api-version=2021-11-01

URI 参数

名称 必需 类型 说明
keyName
path True

string

要对 () 更新或创建的服务器密钥的名称。 密钥名称必须采用“vault_key_version”格式。 例如,如果 keyId 为 https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion,则服务器密钥名称的格式应为:YourVaultName_YourKeyName_YourKeyVersion

resourceGroupName
path True

string

包含该资源的资源组名称。 可以从 Azure 资源管理器 API 或门户获取此值。

serverName
path True

string

服务器的名称。

subscriptionId
path True

string

用于标识 Azure 订阅的订阅 ID。

api-version
query True

string

要用于请求的 API 版本。

请求正文

名称 必需 类型 说明
properties.serverKeyType True

ServerKeyType

服务器密钥类型,例如“ServiceManaged”、“AzureKeyVault”。

properties.uri

string

服务器密钥的 URI。 如果 ServerKeyType 为 AzureKeyVault,则 URI 是必需的。 AKV URI 必须采用以下格式:“https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion”

响应

名称 类型 说明
200 OK

ServerKey

已成功更新服务器密钥。

201 Created

ServerKey

已成功创建服务器密钥。

202 Accepted

已接受

Other Status Codes

错误响应:***

  • 400 InvalidKeyName - 为服务器密钥名称提供了无效值。

  • 400 InvalidKeyType - 不支持创建服务器密钥类型。

  • 400 InvalidUpsertKeyType - 服务托管的 TDE 密钥由服务管理。 服务管理的 TDE 密钥不支持用户创建或更新。

  • 400 InvalidKeyUpsertRequest - 创建服务器密钥请求不存在或没有 properties 对象。

  • 400 SecurityAdalPrincipalCertExpiredError - 无法完成操作,因为 Azure 密钥保管库 主体证书已过期。

  • 400 AkvHostNotResolvingFromNode - 无法从服务器“”{0}上的 SQL 解析 AKV 主机“”。{1}

  • 400 SecurityInvalidAzureKeyVaultRecoveryLevel - 提供的密钥保管库 URI 无效。

  • 400 KeyMaterialNotFoundOnRemoteServer - 远程服务器无权访问用作 TDE 保护器的密钥材料。

  • 400 AzureKeyVaultRsaKeyNotSupported - 提供的密钥保管库使用不受支持的 RSA 密钥大小或密钥类型。 支持的 RSA 密钥大小为 2048 或 3072,密钥类型为 RSA 或 RSA-HSM。

  • 400 AzureKeyVaultKeyDisabled - 无法在服务器上完成该操作,因为 Azure 密钥保管库密钥已禁用。

  • 400 AzureKeyVaultInvalidExpirationDate - 无法完成操作,因为 Azure 密钥保管库密钥过期日期无效。

  • 400 SameKeyUriNotFoundOnRemoteServer - 辅助服务器没有与启用了密钥自动轮换的主服务器的加密保护程序相同的密钥保管库中的密钥材料。

  • 400 安全性AzureKeyVaultUrlNullOrEmpty - 无法完成操作,因为 Azure 密钥保管库 URI 为 null 或空。

  • 400 SameKeyMaterialNotFoundOnRemoteServer - 辅助服务器没有主服务器的加密保护程序的密钥材料。

  • 400 PerDatabaseCMKRestoreNotSupported - 在预览中配置数据库级 CMK 时,不支持数据库还原。

  • 400 AzureKeyVaultNoServerIdentity - 服务器标识未正确配置。

  • 400 PerDatabaseCMKHSNotSupported - 超大规模版本不支持预览版中的数据库级 CMK。

  • 400 AzureKeyVaultInvalidUri - 来自 Azure 密钥保管库的无效响应。 请使用有效的 Azure 密钥保管库 URI。

  • 400 AzureKeyVaultMissingPermissions - 服务器缺少 Azure 密钥保管库所需的权限。

  • 400 UmiMissingAkvPermissions - 用户提供的 PrimaryUserAssignedIdentityId 无权访问提供的 KeyId

  • 400 AkvEndpointNotReachableFromNode - 服务器“”{0}上的 SQL 无法访问 AKV 终结点“”。{1}

  • 400 SecurityAzureKeyVaultInvalidKeyName - 由于服务器密钥名称无效,操作无法完成。

  • 400 AdalGenericError - 无法完成操作,因为遇到 Azure Active Directory 错误。

  • 400 AdalServicePrincipalNotFound - 无法完成操作,因为遇到“找不到 Azure Active Directory 库服务主体”错误。

  • 400 AzureKeyVaultMalformedVaultUri - 提供的密钥保管库 URI 无效。

  • 400 SecurityAzureKeyVaultGeoChainError - 使用 Azure 密钥保管库 (BYOK) 启用透明数据加密时,不支持创建辅助 (称为链接) 的过程。

  • 400 PerDatabaseCMKDWNotSupported - 数据仓库版本不支持预览版中的数据库级 CMK。

  • 400 SecurityAdalPrincipalCertExpiredError - 无法完成操作,因为 Azure 密钥保管库 主体证书已过期。

  • 400 AkvHostNotResolvingFromNode - 无法从服务器“”{0}上的 SQL 解析 AKV 主机“”。{1}

  • 400 SecurityInvalidAzureKeyVaultRecoveryLevel - 提供的密钥保管库 URI 无效。

  • 400 KeyMaterialNotFoundOnRemoteServer - 远程服务器无权访问用作 TDE 保护器的密钥材料。

  • 400 AzureKeyVaultRsaKeyNotSupported - 提供的密钥保管库使用不受支持的 RSA 密钥大小或密钥类型。 支持的 RSA 密钥大小为 2048 或 3072,密钥类型为 RSA 或 RSA-HSM。

  • 400 AzureKeyVaultKeyDisabled - 无法在服务器上完成该操作,因为 Azure 密钥保管库密钥已禁用。

  • 400 AzureKeyVaultInvalidExpirationDate - 无法完成操作,因为 Azure 密钥保管库密钥过期日期无效。

  • 400 SameKeyUriNotFoundOnRemoteServer - 辅助服务器没有与启用了密钥自动轮换的主服务器的加密保护程序相同的密钥保管库中的密钥材料。

  • 400 安全性AzureKeyVaultUrlNullOrEmpty - 无法完成操作,因为 Azure 密钥保管库 URI 为 null 或空。

  • 400 SameKeyMaterialNotFoundOnRemoteServer - 辅助服务器没有主服务器的加密保护程序的密钥材料。

  • 400 PerDatabaseCMKRestoreNotSupported - 在预览中配置数据库级 CMK 时,不支持数据库还原。

  • 400 AzureKeyVaultNoServerIdentity - 服务器标识未正确配置。

  • 400 PerDatabaseCMKHSNotSupported - 超大规模版本不支持预览版中的数据库级 CMK。

  • 400 AzureKeyVaultInvalidUri - 来自 Azure 密钥保管库的无效响应。 请使用有效的 Azure 密钥保管库 URI。

  • 400 AzureKeyVaultMissingPermissions - 服务器缺少 Azure 密钥保管库所需的权限。

  • 400 UmiMissingAkvPermissions - 用户提供的 PrimaryUserAssignedIdentityId 无权访问提供的 KeyId

  • 400 AkvEndpointNotReachableFromNode - 服务器“”{0}上的 SQL 无法访问 AKV 终结点“”。{1}

  • 400 SecurityAzureKeyVaultInvalidKeyName - 由于服务器密钥名称无效,操作无法完成。

  • 400 AdalGenericError - 无法完成操作,因为遇到 Azure Active Directory 错误。

  • 400 AdalServicePrincipalNotFound - 无法完成操作,因为遇到“找不到 Azure Active Directory 库服务主体”错误。

  • 400 AzureKeyVaultMalformedVaultUri - 提供的密钥保管库 URI 无效。

  • 400 SecurityAzureKeyVaultGeoChainError - 使用 Azure 密钥保管库 (BYOK) 启用透明数据加密时,不支持创建辅助 (称为链接) 的过程。

  • 400 PerDatabaseCMKDWNotSupported - 数据仓库版本不支持预览版中的数据库级 CMK。

  • 404 SubscriptionDoesNotHaveServer - 找不到请求的服务器

  • 404 ServerNotInSubscriptionResourceGroup - 指定的服务器不存在于指定的资源组和订阅中。

  • 404 ResourceNotFound - 找不到请求的资源。

  • 404 OperationIdNotFound - ID 为 的操作不存在。

  • 409 ServerKeyNameAlreadyExists - 服务器上已存在服务器密钥。

  • 409 ServerKeyUriAlreadyExists - 服务器上已存在服务器密钥 URI。

  • 409 ServerKeyDoesNotExists - 服务器密钥不存在。

  • 409 AzureKeyVaultKeyNameNotFound - 无法完成操作,因为 Azure 密钥保管库密钥名称不存在。

  • 409 AzureKeyVaultKeyInUse - 服务器当前正在使用密钥。

  • 409 ServerKeyNameAlreadyExists - 服务器上已存在服务器密钥。

  • 409 ServerKeyUriAlreadyExists - 服务器上已存在服务器密钥 URI。

  • 409 ServerKeyDoesNotExists - 服务器密钥不存在。

  • 409 AzureKeyVaultKeyNameNotFound - 无法完成操作,因为 Azure 密钥保管库密钥名称不存在。

  • 409 AzureKeyVaultKeyInUse - 服务器当前正在使用密钥。

  • 409 OperationCancelled - 用户已取消操作。

  • 409 操作中断 - 无法完成对资源的操作,因为同一资源上的另一个操作中断了该操作。

  • 429 SubscriptionTooManyCreateUpdateRequests - 请求数超出可用资源可以处理的最大请求数。

  • 429 SubscriptionTooManyRequests - 请求数超出可用资源可以处理的最大请求数。

  • 500 OperationTimedOut - 操作超时并自动回滚。 请重试该操作。

  • 503 AzureKeyVaultConnectionFailed - 无法在服务器上完成该操作,因为尝试连接到 Azure 密钥保管库失败

  • 503 AzureKeyVaultGenericConnectionError - 无法完成该操作,因为在尝试检索密钥保管库信息 时遇到错误。

  • 503 AzureKeyVaultConnectionFailed - 无法在服务器上完成该操作,因为尝试连接到 Azure 密钥保管库失败

  • 503 AzureKeyVaultGenericConnectionError - 无法完成该操作,因为在尝试检索密钥保管库信息 时遇到错误。

  • 503 TooManyRequests - 请求数超出可用资源可以处理的最大请求数。

示例

Creates or updates a server key

Sample Request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/keys/someVault_someKey_01234567890123456789012345678901?api-version=2021-11-01

{
  "properties": {
    "serverKeyType": "AzureKeyVault",
    "uri": "https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"
  }
}

Sample Response

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/keys/someVault_someKey_01234567890123456789012345678901",
  "name": "sqlcrudtest-4645",
  "type": "Microsoft.Sql/servers/keys",
  "location": "Japan East",
  "kind": "azurekeyvault",
  "properties": {
    "thumbprint": "00112233445566778899AABBCCDDEEFFAABBCCDD",
    "creationDate": "2020-11-15T00:00:00Z",
    "autoRotationEnabled": false
  }
}
{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/keys/someVault_someKey_01234567890123456789012345678901",
  "name": "sqlcrudtest-4645",
  "type": "Microsoft.Sql/servers/keys",
  "location": "Japan East",
  "kind": "azurekeyvault",
  "properties": {
    "thumbprint": "00112233445566778899AABBCCDDEEFFAABBCCDD",
    "creationDate": "2020-11-15T00:00:00Z",
    "autoRotationEnabled": false
  }
}

定义

名称 说明
ServerKey

服务器密钥。

ServerKeyType

服务器密钥类型,例如“ServiceManaged”、“AzureKeyVault”。

ServerKey

服务器密钥。

名称 类型 说明
id

string

资源 ID。

kind

string

加密保护程序的种类。 这是用于Azure 门户体验的元数据。

location

string

资源位置。

name

string

资源名称。

properties.autoRotationEnabled

boolean

密钥自动轮换选择加入标志。 true 或 false。

properties.creationDate

string

服务器密钥创建日期。

properties.serverKeyType

ServerKeyType

服务器密钥类型,例如“ServiceManaged”、“AzureKeyVault”。

properties.subregion

string

服务器密钥的子区域。

properties.thumbprint

string

服务器密钥的指纹。

properties.uri

string

服务器密钥的 URI。 如果 ServerKeyType 为 AzureKeyVault,则 URI 是必需的。 AKV URI 必须采用以下格式:“https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion”

type

string

资源类型。

ServerKeyType

服务器密钥类型,例如“ServiceManaged”、“AzureKeyVault”。

名称 类型 说明
AzureKeyVault

string

ServiceManaged

string