首页 > 解决方案 > Start-AzAutomationRunbook 不断失败,并出现“未指定 Runbook 强制参数”。参数名称 ResourceGroupName。

问题描述

我正在尝试使用 powershell 启动自动化运行手册,但命令不断失败并出现以下错误...

Start-AzAutomationRunbook : Runbook mandatory parameter not specified. Parameter name ResourceGroupName.

这是我正在运行的命令...

Start-AzAutomationRunbook -AutomationAccountName "existingAccountName" -Name "existingRB" -ResourceGroupName "existingRG" -MaxWaitSeconds 2000 -Wait

我已确认自动化帐户存在、资源组存在、运行手册存在。我已经成功地在控制台中启动了运行手册,没有出现错误。

我希望在 Powershell 中运行 Start-AzAutomationRunbook 时启动运行手册。

标签: azurepowershell

解决方案


看来您的作业脚本需要一个resourcegroupname参数才能运行。您在下面的行中指定的资源组是运行手册所在帐户的资源组。

Start-AzAutomationRunbook -AutomationAccountName "existingAccountName" -Name "existingRB" -ResourceGroupName "existingRG" -MaxWaitSeconds 2000 -Wait

要将资源组或参数应用于实际作业,您必须传递参数,如果您的作业只需要 ResourceGroupName,则下面应该可以工作。

$AutomationRG = "existingRG"

$params = @{"ResourceGroupName"="$AutomationRG"}

Start-AzureRmAutomationRunbook -AutomationAccountName "existingAccountName" -Name "existingRB" -ResourceGroupName $AutomationRG -Parameters $params


推荐阅读