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



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

{
"$schema": "...",
"contentVersion": "1.0.0.0",
"parameters": {
...
"SkipThisComponent": {
"type": "bool"
...
}

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

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

我尝试了几种方法,但似乎equals只支持 [int、字符串、数组或对象],if需要条件和值来匹配它等。我没有找到一个很好的干净方法,似乎都是铸造的解决方法......

您可以在条件中仅使用该变量:

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

逻辑函数参考

最新更新