【发布时间】:2022-01-01 10:06:12
【问题描述】:
我在 Azure 自动化帐户中放置了一个相当简单的脚本,用于停止 Azure 容器实例。当我测试它或单击开始按钮时,我从门户顺利运行,没有产生错误并正确完成工作。 '''
Param
(
[parameter (Mandatory=$false)]
[object]$WebhookData
)
try
{
"Logging in to Azure..."
Connect-AzAccount -Identity
}
catch {
Write-Error -Message $_.Exception
throw $_.Exception
}
$ACIs = Get-AzContainerGroup
foreach ($ACI in $ACIs)
{
Write-Output ("Shutting down the following Azure Container Instance: " + $ACI.Name)
Stop-AzContainerGroup -Name $ACI.Name -ResourceGroupName 'MY_RESOURCE_GROUP_NAME'
Write-Output ("")
}
我创建了一个 webhook 来启动该脚本。每当我发送发布请求以触发该脚本时,它都会失败并出现以下错误: '''
ParserError:
Line |
| … .ps1' -WebhookData {WebhookName:XXXX,RequestB …
| ~
| Missing argument in parameter list.
我尝试在消息正文中添加某项内容,从 PowerShell 和 Postman 发送请求。我收到了 JobIds 和状态码 202 的回复。我一直在寻找类似的问题,但我得到的唯一问题是 one 没有回答。
有什么想法吗?
【问题讨论】:
标签: azure webhooks azure-powershell azure-automation