9
votes

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
doesn't "condition" : "[variables('SkipThisComponent')" work? - Martin Brandl
somehow I am having a slow day today. Of course that works :) What I used in the end is "condition": "[not(parameters('SkipThisComponent'))]", but it is the same think. Please post the answer and I will accept it. - Denis Biondic
Thanks for the reply. Glad to help you! Posted the answer - Martin Brandl

1 Answers

15
votes

You can just use the variable within the condition:

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

Logic Functions Ref.