Azure DevOps 中的 Azure ARM 模板密钥库覆盖 [英] Azure ARM template keyvault override in Azure DevOps

查看:39
本文介绍了Azure DevOps 中的 Azure ARM 模板密钥库覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Azure DevOps 中覆盖 ARM 模板 Azure 密钥库引用?我有一个 ARM 模板,它有如下参考:

How can I override the ARM template Azure keyvault reference in Azure DevOps? I have ARM template which has reference like:

"KeyVaultSecret": {
  "reference": {
    "keyVault": {
      "id": "/subscriptions/214124-1241-526-645-lele/resourceGroups/KEYVAULT-RG/providers/Microsoft.KeyVault/vaults/KeyVault"
    },
    "secretName": "VerySecret"
  }
}

但我想在某些情况下覆盖 id 和/或 secretName.

but I would like to override the id and/or secretName in some cases.

推荐答案

你总是可以使用嵌套模板来做到这一点,只需提供一个带值的参数,然后使用嵌套模板来调用它.这里是嵌套模板以获取 KV 值.您可以轻松地将我链接到的硬编码值替换为参数或表达式,这将允许您执行所需的操作.

You can always use nested templates to do that, just provide a parameter with value, and then use nested template to invoke that. Here's that is using nested templates to get KV values. you can easily replace hardcoded value which I link to with a parameter or with expression, which would allow you to do what you need.

您可能会采用类似开关"的方法来根据资源组名称确定所需的值.

You might go as far as implementing a "switch" like approach to determine needed value based on resource group name.

这篇关于Azure DevOps 中的 Azure ARM 模板密钥库覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆