【发布时间】:2020-09-18 17:45:53
【问题描述】:
我有提供数据湖的 ARM 模板,我想将其秘密存储在密钥库中。 我假设我应该使用 ARM 中的输出部分,像这样的 JSON,但是我应该如何将它存储在已经存在的 (!) Key Vault 中?
"outputs": {
"storageAccountName": {
"type": "string",
"value": "[variables('storageAccountName')]"
},
"storageAccountConnectionString": {
"type": "string",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountResourceId'), variables('storageAccountApiVersion')).keys[0].value)]"
}
}
【问题讨论】:
-
下面的答案很好,但有一点 - 不要将秘密放在模板部署的输出中 - 对部署(例如资源组)具有“读取”权限的用户可以看到输出,所以它会将秘密暴露给这些用户。相反,输出包含秘密的资源的 resourceId() 并在需要它的模板中使用它(下面的答案中的示例)
标签: azure azure-resource-manager azure-keyvault azure-template