Azure RM 模板 AutomationRunbookServiceUriIsNotValid

Azure RM Template AutomationRunbookServiceUriIsNotValid

我需要使用 ARM 模板部署 "microsoft.insights/actionGroups" 类型的资源,但我遇到了一个问题。我的模板:

{
     "apiVersion": "2019-06-01",
     "type": "microsoft.insights/actionGroups",
     "location": "Global",
     "name": "[variables('ActionGroupName')]",
     "tags": {
        "displayName": "MyActionGroupName"
     },
     "properties": {
        "groupShortName": "variables('ActionGroupShortName')",
        "enabled": true,
        "automationRunbookReceivers": [
           {
              "name": "MyRunbookRecieverName",
              "automationAccountId": "[resourceId('microsoft.insights/components', parameters('AzureTelemetryName'))]",
              "runbookName": "MyRunbook",
              "webhookResourceId": "[resourceId('Microsoft.Automation/automationAccounts/webhooks', parameters('AzureAutomationName'), 'WebHookName')]",
              "isGlobalRunbook": false
           }
        ]
     }
  }

但是当我尝试部署时出现此错误:

New-AzureRmResourceGroupDeployment : 08:39:52 - Resource microsoft.insights/actionGroups 'ActionGroupName' failed with message '{ "Code": "AutomationRunbookServiceUriIsNotValid", "Message": "AutomationRunbookServiceUriIsNotValid"

我查看了template definition,上面提到WebhookReceiver.identifierUri不是必须的。

我做错了什么?

我可以用模板重现您的问题,我在 automationRunbookReceivers 中添加了 serviceUri,然后就可以正常工作了。您可以参考此 link 创建 webhook。

 "automationRunbookReceivers": [
           {
              "name": "MyRunbookRecieverName",
              "automationAccountId": "[resourceId('microsoft.insights/components', parameters('AzureTelemetryName'))]",
              "runbookName": "MyRunbook",
              "webhookResourceId": "[resourceId('Microsoft.Automation/automationAccounts/webhooks', parameters('AzureAutomationName'), 'WebHookName')]",
              "isGlobalRunbook": false,
              "serviceUri":"https://s16events.azure-automation.net/webhooks?token=xxxxxxxxxxxx"
           }
        ]

对于serviceUri这个不是必须的问题,不知道是不是文档有什么错误,只是一些测试结果供大家参考。(如果我做错了,请指正。 )

doc中,如下所示。 nameNo 必需的,但如果我在没有它的情况下进行部署,我会收到 AutomationRunbookReceiverNameIsNullOrEmpty 错误。 useCommonAlertSchema 是必需的,但如果我在没有它的情况下进行部署,我将不会收到任何错误。同样的事情发生在 serviceUri.