繁体   English   中英

使用 ARM 模板将密钥添加到 azure 中的现有密钥库

[英]Add keys to an existing keyvault in azure using ARM template

请在将以下 ARM 模板发送到 azure 时收到以下错误消息。 我想做的是将密钥添加到 azure 上的现有密钥保管库(通过订阅)。 命名空间配置应负责将密钥存储在 Key Vault 中

错误:

05:12:00    "error": {
05:12:00      "message": "Encryption properties cannot be specified on creation of a namespace. They must be specified in a subsequent update. CorrelationId: dd69feae-5ba9-4c7e-9599-673493d31748",
05:12:00      "code": "BadRequest"
05:12:00    }

请求正文:

 "resources": [
  {
    "type": "Microsoft.EventHub/namespaces",
    "apiVersion": "2018-01-01-preview",
    "name": "[variables('eventHubNamespaceName')]",
    "location": "[parameters('location')]",
    "identity":{
        "type":"SystemAssigned"
     },
    "sku": {
      "name": "[parameters('eventHubSku')]",
      "tier": "[parameters('eventHubSku')]",
      "capacity": 1
    },
    "properties": {
       "isAutoInflateEnabled": false,
       "maximumThroughputUnits": 0,
       "clusterArmId":"[resourceId('Microsoft.EventHub/clusters', parameters('eventHubName'))]",
         "encryption":{
           "keySource":"Microsoft.KeyVault",
           "keyVaultProperties":[
              {
                 "keyName":"[variables('eventHubNamespaceName')]",
                 "keyVaultUri":"[parameters('keyVaultUri')]"
              }
           ]
        }
  }
  },
  {
     "type": "Microsoft.EventHub/namespaces/eventhubs",
    "apiVersion": "2017-04-01",
    "name": "[concat(variables('eventHubNamespaceName'), '/', variables('eventHubName'))]",
    "location": "[parameters('location')]",
    "dependsOn": [
      "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNamespaceName'))]"
    ],
    "properties": {
      "messageRetentionInDays": "[parameters('messageRetentionInDays')]",
      "partitionCount": "[parameters('partition_count')]"
    }
  }
]

您似乎正在尝试同时在同一 ARM 模板中设置事件中心命名空间设置加密属性。 因此错误。

我建议按以下顺序执行这些任务:

  1. 首先,使用托管服务标识创建事件中心命名空间。
  2. 接下来,创建一个 Key Vault 并授予服务标识对 Key Vault 的访问权限。
  3. 然后,使用密钥保管库信息(键/值)更新事件中心命名空间。

事件中心文档中提供了更详细的演练。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM