ARM模板IF函数排除JSON元素。 [英] ARM Template IF function exclude JSON element.

查看:104
本文介绍了ARM模板IF函数排除JSON元素。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

是否可以根据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.

参考:
https://github.com/Azure/azure-quickstart-templates/blob/master/100-marketplace-sample/azuredeploy.json#L298

希望这会有所帮助





这篇关于ARM模板IF函数排除JSON元素。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆