我在 Azure Key Vault 中创建了一个包含从 .pfx 转换为 base64 字符串的 ssl 证书的机密。现在我尝试使用它来创建一个使用二头肌文件链接到应用服务的证书。
resource kv 'Microsoft.KeyVault/vaults@2021-06-01-preview' = {
name: 'mykeyvault'
location: resourceGroup().location
properties: {
tenantId: tenantId
sku: {
name: 'standard'
family: 'A'
}
enabledForTemplateDeployment: true
accessPolicies: [...]
}
}
resource sslCertificateSecret 'Microsoft.KeyVault/vaults/secrets@2021-06-01-preview' = {
name: '${kv.name}/sslcert'
properties: {
attributes: {
enabled: true
}
value: <base64_string_ssl>
contentType: 'application/x-pkcs12'
}
}
resource appServicePlan 'Microsoft.Web/serverfarms@2021-01-15' = {
name: 'myServiceplan'
location: resourceGroup().location
kind: 'linux'
properties: {
reserved: true
}
sku: {
name: 'B1'
}
}
resource sslCertificate 'Microsoft.Web/certificates@2021-01-15' = {
name: 'myCertificate'
location: resourceGroup().location
properties: {
keyVaultId: <my_keyvaultId>
keyVaultSecretName: <my_keyvaultCertificateSecretName>
serverFarmId: appServicePlan.id
}
}
我还尝试在密钥库中手动导入证书并重新导出它以确保 base64 字符串正确并且看起来没问题。
但是我收到错误“参数 KeyVault 证书的值无效。”
你知道我错过了什么吗?