Azure的自动化错误'DynamicActivity“:预期类型的​​输入参数值 [英] Azure Automation Error 'DynamicActivity': Expected an input parameter value of type

查看:271
本文介绍了Azure的自动化错误'DynamicActivity“:预期类型的​​输入参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Microsoft采样使用-RunbookParameter脚本并运行以下Azure的自动化PowerShell的:

  $日期=获取最新
$ PARAMS = @ {姓名=世界,数= 1; 日期= $日期; SayGoodBye= $ TRUE; 字符串数组=[1,'astringvalue',2]}
启动AzureAutomationRunbook -AutomationAccountName CMTEST杂牌采样使用-α参数RunbookParameters $ PARAMS

我得到了以下异常:

 规定的根活动的参数不符合根系活力的要求值:
DynamicActivity:预期类型的​​名为SayGoodbye参数的输入参数值'System.Boolean'。
DynamicActivity:预期名为日期参数类型的System.DateTime的输入参数值。
 jParameter名称:rootArgumentValues

如果我看在Azure的自动化作业日志我看到下面的输入参数:

 日期星期五,2014年8月8日15点26分14秒GMT
NAME世界
1号
SAYGOODBYE真
字符串数组[1,'astringvalue',2]


解决方案

这是由于将固定在即将到来的Azure中的PowerShell发布Azure的自动化的cmdlet的错误(如果没有下一个,后一) 。基本上,该cmdlet应该序列化每个作业参数作为JSON,但目前将它们作为各自为一个字符串。

此外,一旦这个是固定的,而不是做上述在code,你正在做的:

 字符串数组=[1,'astringvalue',2]

您将需要使用适当的PowerShell数组:

  $ =的someArray @(1,astringvalue,2)
字符串数组= $的someArray

When using the Microsoft Sample-Using-RunbookParameter script and running the following Azure Automation PowerShell:

$date = Get-Date
$Params = @{"Name"="World";"Number"=1; "Date"=$date; "SayGoodBye"=$TRUE; "StringArray"="[1,'astringvalue',2]"}
Start-AzureAutomationRunbook -AutomationAccountName CMTEST -Name Sample-Using-RunbookParameters -Parameters $Params

I get the following exception:

The values provided for the root activity's arguments did not satisfy the root activity's requirements:
'DynamicActivity': Expected an input parameter value of type 'System.Boolean' for parameter named 'SayGoodbye'.
'DynamicActivity': Expected an input parameter value of type 'System.DateTime' for parameter named 'Date'.
 jParameter name: rootArgumentValues

If I look in the Azure Automation Job log I see the following input parameters:

DATE Fri, 08 Aug 2014 15:26:14 GMT
NAME World
NUMBER 1
SAYGOODBYE True
STRINGARRAY [1,'astringvalue',2]

解决方案

This is due to a bug in the Azure Automation cmdlets that will be fixed in an upcoming Azure PowerShell release (if not the next one, the one after that). Basically, the cmdlet is supposed to serialize each job parameter as json, but is currently passing them as each as a string.

Also, once this is fixed, instead doing the above in your code as you are currently doing:

"StringArray"="[1,'astringvalue',2]"

You will want to use a proper PowerShell array:

$SomeArray = @(1, "astringvalue", 2)
"StringArray"=$SomeArray

这篇关于Azure的自动化错误'DynamicActivity“:预期类型的​​输入参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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