在 Azure 资源管理器 (ARM) 模板中为条件使用 bool 参数类型

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

在具有以下参数的 ARM 模板中:

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

  ...

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

   ...
}

如何在资源条件下使用它?

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

我尝试了几种方法,但似乎 equals 仅支持 [int、string、array 或 object],if 需要条件和值来匹配它等。我没有找到一个很好的干净方法,所有似乎都是转换的解决方法...

您可以只在条件内使用变量:

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

Logic Functions Ref.