Azure 自动化 powershell,不工作 int 输入参数
Azure automation powershell, not work int input parameter
我使用 azure 自动化,
并且有这样的代码
workflow Report
{
param
(
[parameter(Mandatory=$True)]
[string] $Name,
[parameter(Mandatory=$true)]
[Int] $MyCount
)
inlinescript
{
Write-Verbose "Name $Name"
Write-Verbose "Count $MyCount"
}
}
在测试窗格中(在 https://portal.azure.com 上)我为此参数设置了下一个值:"Test" 和 2
在控制台中,我看到下一个结果:
Name Test
Count
$Name 工作正常
但未显示 $MyCount
根据文档,我做的一切都是正确的
https://technet.microsoft.com/en-us/library/hh847743.aspx
如何使用 int 输入参数?
根据这个posthttps://technet.microsoft.com/en-us/library/jj574197.aspx
在 inlinescript 我无法访问主要变量
为了获取主要变量,我需要使用 $Using
Write-Verbose "Count $Using:MyCount"
我遇到了类似的问题,我注意到我的 runbook 类型必须是 "PoweShell Workflow Runbook" 下的其他。
当我只选择 PowerShell 时 none 我的参数会出现在我的测试窗格中
我使用 azure 自动化,
并且有这样的代码
workflow Report
{
param
(
[parameter(Mandatory=$True)]
[string] $Name,
[parameter(Mandatory=$true)]
[Int] $MyCount
)
inlinescript
{
Write-Verbose "Name $Name"
Write-Verbose "Count $MyCount"
}
}
在测试窗格中(在 https://portal.azure.com 上)我为此参数设置了下一个值:"Test" 和 2
在控制台中,我看到下一个结果:
Name Test
Count
$Name 工作正常
但未显示 $MyCount
根据文档,我做的一切都是正确的
https://technet.microsoft.com/en-us/library/hh847743.aspx
如何使用 int 输入参数?
根据这个posthttps://technet.microsoft.com/en-us/library/jj574197.aspx
在 inlinescript 我无法访问主要变量
为了获取主要变量,我需要使用 $Using
Write-Verbose "Count $Using:MyCount"
我遇到了类似的问题,我注意到我的 runbook 类型必须是 "PoweShell Workflow Runbook" 下的其他。
当我只选择 PowerShell 时 none 我的参数会出现在我的测试窗格中