Using bool parameter type for conditions in Azure Resource Manager (ARM) templates

一个人想着一个人 提交于 2019-12-10 14:12:50

问题


In an ARM Template with a following parameter:

{
  "$schema": "...",
  "contentVersion": "1.0.0.0",
  "parameters": {

  ...

    "SkipThisComponent": {
      "type": "bool"

   ...
}

how would one use it inside a resource condition?

"resources": [
    {
      "apiVersion": "...",
      "name": "...",
      "type": "...",
      "condition": "[???]",

I tried out several approaches, but it seems that equals supports only [int, string, array, or object], if needs both the condition and values to match it to etc. I didn't find a nice clean approach, all seem to be workarounds with casting...


回答1:


You can just use the variable within the condition:

"condition" : "[variables('SkipThisComponent')]"


来源:https://stackoverflow.com/questions/50718906/using-bool-parameter-type-for-conditions-in-azure-resource-manager-arm-templat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!