将 Powershell 开关传递给 Azure 资源管理器模板 (ARM) [英] Pass Powershell switch to an Azure Resource Manager Template (ARM)
本文介绍了将 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.
推荐答案
假设你的 switch 叫做 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屋!
查看全文