Search code examples
azurepowershellazure-rm-templateazure-rm

Azure RM Template AutomationRunbookServiceUriIsNotValid


I need to deploy a resource of type "microsoft.insights/actionGroups" with ARM Template and I am stuck on a problem. My Template :

{
     "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
           }
        ]
     }
  }

But when I try to deploy I get this error:

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

I look over template definition, and it is mentioned that WebhookReceiver.identifierUri is not mandatory.

What am I doing wrong?


Solution

  • I can reproduce your issue with the template, I add the serviceUri in the automationRunbookReceivers, then it works fine. You can refer to this link to create the 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"
               }
            ]
    

    To the serviceUri is not required issue, I am not sure if there is some mistake of the doc, just some test result for you to refer.(If I do something wrong, please correct me.)

    In the doc, it appears like below. The name is No required, but if I deploy without it, I get the AutomationRunbookReceiverNameIsNullOrEmpty error. The useCommonAlertSchema is required, but if I deploy withou it, I will get no error. The same thing happens to the serviceUri.

    enter image description here