ARM模板IF函数排除JSON元素。 [英] ARM Template IF function exclude JSON element.
问题描述
是否可以根据IF语句排除JSON部分。
Is it possible to exclude a section of JSON based upon a IF statement.
我是部署虚拟网络网关,但我需要定义VNET网关是用于Prod还是非Prod,它将VNET配置为主动/主动。
I'm deploying a Virtual Network Gateway, but i need to define if the VNET Gateway is for Prod or Non-Prod which will configure the VNET as active/active.
如果我选择非prod部署失败,因为JSON包含2个IP配置,因为活动的活动配置,所以理想情况下我需要从JSON中删除该部分。
IF i select non-prod the deployment fails as the JSON contains 2 IP configurations due to the active active configuration, so ideally i need to remove the section from the JSON.
推荐答案
您可以使用json()函数从if()中删除json中的节,例如json('null'),
如果名称为空,那将完全删除可用性集属性。
That will remove the availability set property altogether if the name is empty.
希望这会有所帮助
这篇关于ARM模板IF函数排除JSON元素。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!