常见参数和标头Common parameters and headers

以下信息常见于与 Key Vault 资源相关的所有操作:The following information is common to all operations that you might do related to Key Vault resources:

  • HTTP Host 标头必须始终存在并且必须指定保管库主机名。The HTTP Host header must always be present and must specify the vault hostname. 示例:Host: contoso.vault.azure.cnExample: Host: contoso.vault.azure.cn. 请注意,大多数客户端技术将从 URI 填充 Host 标头。Note that most client technologies populate the Host header from the URI. 例如,GET https://contoso.vault.azure.cn/secrets/mysecret{...} 会将 Host 设置为 contoso.vault.azure.cnFor instance, GET https://contoso.vault.azure.cn/secrets/mysecret{...} will set the Host as contoso.vault.azure.cn. 这意味着,如果使用 GET https://10.0.0.23/secrets/mysecret{...} 等原始 IP 地址访问 Key Vault,Host 标头的自动值将是错误的,并且必须手动确保 Host 标头包含保管库主机名。This means that if you access Key Vault using raw IP address like GET https://10.0.0.23/secrets/mysecret{...}, the automatic value of Host header will be wrong and you will have to manually insure that the Host header contains the vault hostname.
  • {api-version} 替换为 URI 中的 API 版本。Replace {api-version} with the api-version in the URI.
  • {subscription-id} 替换为 URI 中的订阅标识符Replace {subscription-id} with your subscription identifier in the URI
  • {resource-group-name} 替换为资源组。Replace {resource-group-name} with the resource group. 有关详细信息,请参阅“使用资源组管理 Azure 资源”。For more information, see Using Resource groups to manage your Azure resources.
  • {vault-name} 替换为 URI 中 Key Vault 的名称。Replace {vault-name} with your key vault name in the URI.
  • 将 Content-Type 表头设置为 application/json。Set the Content-Type header to application/json.
  • 将授权标头设置为从 Azure Active Directory (AAD) 获取的 JSON Web 令牌。Set the Authorization header to a JSON Web Token that you obtain from Azure Active Directory (AAD). 有关详细信息,请参阅对 Azure 资源管理器请求进行身份验证For more information, see Authenticating Azure Resource Manager requests.

常见错误响应Common error response

服务使用 HTTP 状态代码指示成功或失败。The service will use HTTP status codes to indicate success or failure. 此外,失败还会包含采用以下格式的响应:In addition, failures contain a response in the following format:

   {  
     "error": {  
     "code": "BadRequest",  
     "message": "The key vault sku is invalid."  
     }  
   }  
元素名称Element name 类型Type 说明Description
codecode stringstring 发生的错误类型。The type of error that occurred.
messagemessage stringstring 错误原因说明。A description of what caused the error.

另请参阅See Also

Azure Key Vault REST API 参考Azure Key Vault REST API Reference