将Powershell开关传递到Azure资源管理器模板(ARM) [英] Pass Powershell switch to an Azure Resource Manager Template (ARM)

查看:97
本文介绍了将Powershell开关传递到Azure资源管理器模板(ARM)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何直接将Powershell开关(System.Management.Automation.SwitchParameter)传递给ARM模板(将在模板本身中用作条件)?

How can I directly pass a powershell switch (System.Management.Automation.SwitchParameter) to an ARM template (which will be used as a condition in the template itself)?

当前,我正在使用将开关转换为字符串的解决方法.

Currently I am using the workaround of converting the switch to an string.

推荐答案

可以说您的开关称为fullversion:

Lets say your switch is called fullversion:

param(
...
[switch]$fullversion
)

并且您的参数文件还包含一个名为fullversion的参数,则可以像这样传递它:

and your parameterfile also contains a parameter called fullversion then you can pass it like:

New-AzureRmResourceGroupDeployment -fullversion $fullversion.IsPresent

这篇关于将Powershell开关传递到Azure资源管理器模板(ARM)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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