我有一个处于运行状态的PowerShell Azure Runbook。
通过 Azure 门户按"停止"会导致错误消息:
"工作无法停止"。
使用 PowerShell cmdlet Stop-AzureRMAutomationJob 会导致错误消息:
"内部服务器错误: {"消息":"发生错误。"}
从文档中看,作业将在 3 小时后停止,但是有没有其他方法可以停止 Runbook 作业或处理此类情况?
此问题已转到Microsoft产品组进行修复,现在应该已修复。
首先你应该找到状态失败的作业 ID...
Get-AzureRmAutomationJob -ResourceGroupName $RG -AutomationAccountName $AA | where {$.RunbookName -eq "runbook name" -and $.status -eq"Failed"}
然后在停止运行手册后
Stop-AzureRmAutomationJob -ResourceGroupName $RG -AutomationAccountName $AA -id JOBID