Search code examples
azureazure-resource-managerazure-rm-template

Azure RM Template resourceId() for webhooks


I want to create actionGroups via ARM template. And I did not find how to reference webhookResourceId.

{
     "apiVersion": "2019-06-01",
     "type": "microsoft.insights/actionGroups",
     "location": "Global",
     "name": "[variables('ActionGroupCallRunBook')]",
     "properties": {
        "enabled": true,
        "automationRunbookReceivers": [
           {
              "name": "[concat('webhook-',variables('ActionGroupCallRunBook'))]",
              "automationAccountId": "[resourceId('microsoft.insights/components', parameters('AzureTelemetryName'))]",
              "runbookName": "myRunbook",
              "webhookResourceId": "[resourceId('Microsoft.Automation/automationAccounts/webhooks'), parameters('WebHookOnRunBookName')]",
              "isGlobalRunbook": false,
              "useCommonAlertSchema": false
           }
        ]
     },
     "tags": {
        "displayName": "ActionGroupCallRunBook"
     }
  }

"webhookResourceId": "[resourceId('Microsoft.Automation/automationAccounts/webhooks'), parameters('WebHookOnRunBookName')]" return an error!


Solution

  • right, because you'd have to use resourceId() like so:

    resourceId('Microsoft.Automation/automationAccounts/webhooks', 'automationaccountname`, 'webhookname`)
    

    Reading: https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#resourceid