然后把JSON内容保存为一个文件,使用az keyvault secret set --file "" --encoding base64 添加到Key Vault中
注意:可以使用证书指纹作为机密名称,以方便更好的关联到证书信息
设置Key Vault机密
复制代码
##intermediate
az keyvault secret set --vault-name <key value name> --name <thumbprint> --file ".\SSL\intermediate.txt" --encoding base64
##root
az keyvault secret set --vault-name <key value name> --name <thumbprint> --file ".\SSL\root.txt" --encoding base64
执行完成后,从返回结果中获取到 id 值(Secret Identifier URL).
完成以上内容后,复制出指纹值和Secret ID URL,就可以通过Cloud Service (Extended Support)的API更新证书。
GET https:// management.chinacloudapi.cn /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}?api-version=2022-04-04
需要携带Authorization Token,否则会获得如下错误:
复制代码
{
"error": {
"code": "AuthenticationFailed",
"message": "Authentication failed. The 'Authorization' header is missing."
}
}
az cloud set --name AzureChinaCloud
az login
az account get-access-token --scope "https://management.core.chinacloudapi.cn/.default" --query accessToken
{
"error": {
"code": "CertificateImproperlyFormatted",
"message": "The data retrieved from https://XXXXXXXXX.vault.azure.cn/secrets/XXXXX/7eXXXX is not deserializable into JSON."
}
}