azure - 使用 ARM 模板将密钥添加到 azure 中的现有密钥库
问题描述
请在将以下 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 模板中设置加密属性。因此错误。
我建议按以下顺序执行这些任务:
- 首先,使用托管服务标识创建事件中心命名空间。
- 接下来,创建一个 Key Vault 并授予服务标识对 Key Vault 的访问权限。
- 然后,使用密钥保管库信息(键/值)更新事件中心命名空间。
事件中心文档中提供了更详细的演练。
推荐阅读
- react-native - React navigation 5 底部标签栏 android 键盘 ISSUE
- algorithm - 如何编写一个遍历所有小写到数字映射的函数?
- c# - 在返回使用自动映射器映射的 DTO 时,如何为其分配子类类型的列表?
- python - AttributeError:部分初始化的模块'socket'没有属性'gethostbyname'(很可能是由于循环导入) - Python
- typescript - chromeless 库中的 evaluate() 不适用于 TypeScript
- python - 获取订购菜肴(Django ORM)中所有使用成分的数量以制作购物清单
- caching - 一次性事件的浏览器存储?
- embedded - 在 Bazel Build 中导入 cmocka 库
- chart.js - 添加从点到x轴的线和他的粗体标签
- javascript - 样式组件不导出