azure - 部署包含 key 保管库中存储的证书的 ARM 模板时出错

标签 azure azure-resource-manager azure-keyvault

我正在尝试从发布管理部署 ARM 模板,其中包含“Microsoft.Web/certificates”资源,该资源引用存储在 key 保管库中的证书。当 key 保管库与我要部署到的资源组存在于同一订阅中时,此方法可以正常工作。但是,当 key 保管库存在于不同的订阅中时,我收到以下错误。

资源 Microsoft.Web/certificates“证书名称”失败并显示消息

{
    "Code": "BadRequest",
    "Message": "The parameter Properties.KeyVaultId has an invalid value.",
    "Target": null,
    "Details": [
    {
      "Message": "The parameter Properties.KeyVaultId has an invalid value."
    },
    {
      "Code": "BadRequest"
    },
    { 
      "ErrorEntity": {
        "Code": "BadRequest",
        "Message": "The parameter Properties.KeyVaultId has an invalid value.",
        "ExtendedCode": "51008",
        "MessageTemplate": "The parameter {0} has an invalid value.",
        "Parameters": [
          "Properties.KeyVaultId"
        ],
        "InnerErrors": null
      }
    }
    ], 
    "Innererror": null
}'

证书资源在我的模板中定义如下。

    {
        "type":"Microsoft.Web/certificates",
        "name": "SomeName",
        "location": "East US 2",
        "apiVersion": "2016-03-01",
        "properties": {
            "keyVaultId": "/subscriptions/<subscriptionId>/resourceGroups/<vault resource group>/providers/Microsoft.KeyVault/vaults/<vault name>",
            "keyVaultSecretName": "SecretName"                
        }            
    }

我正在 VSTS 中使用 Azure 资源组部署任务来部署资源组。该任务配置为使用具有服务主体的终结点,该服务主体在 Azure 中设置了以下权限:

  • 包含 key 保管库的资源组上的 key 保管库参与者角色。
  • 获取 key 保管库的 secret 权限

Microsoft.Azure.WebSites 主体被授予对 key 保管库 secret 的获取权限。

key 保管库还启用了“启用对 Azure 资源管理器的访问以进行模板部署”选项。证书是使用 powershell 上传到 key 保管库的,而不是通过门户。

我在这里遗漏了什么吗?

谢谢

最佳答案

我想我找到了这个问题的原因。显然,当资源组创建后,您就无法更改 secret 名称。如果这样做,将会抛出上面的错误。

如果您想更改 secret 名称,您需要删除资源组并重新部署所有内容。

您是否在 ARM 模板中更改了 secret 名称,而没有删除 Azure 门户中的完整资源组?

关于azure - 部署包含 key 保管库中存储的证书的 ARM 模板时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40879685/

相关文章:

azure - 无法启动存储模拟器

sql-server - 为 Azure SQL 池创建主 key 时出现问题 - 权限错误

azure - 如何使用 Bicep 配置 "All APIs"策略?

azure - Azure 资源管理器中的 possibleOutboundIpAddresses 和 outboundIpAddresses 字段有什么区别?

c# - 使用未部署在 Azure 中的应用程序访问 Azure Key Vault 存储的 secret

azure - 如何使用 Spring Boot 应用程序从 azure key Vault 获取或检索 key / secret

azure - 无法删除 Microsoft Azure 服务总线命名空间

azure - 通过 ARM 模板为服务连接用户分配角色

c# - 尝试连接时,Azure Vault 中的 GetSecret 抛出 NullReferenceException

node.js - 客户端无法连接到Azure应用程序服务上托管的nodejs websocket服务器?