Resource Manager template samples for action groups in Azure Monitor

This article includes sample Azure Resource Manager templates to create action groups in Azure Monitor. Each sample includes a template file and a parameters file with sample values to provide to the template.

Note

See Azure Resource Manager samples for Azure Monitor for a list of samples that are available and guidance on deploying them in your Azure subscription.

Create an action group

The following sample creates an action group.

Template file

@description('Unique name within the resource group for the Action group.')
param actionGroupName string

@description('Short name up to 12 characters for the Action group.')
param actionGroupShortName string

resource actionGroup 'Microsoft.Insights/actionGroups@2021-09-01' = {
  name: actionGroupName
  location: 'Global'
  properties: {
    groupShortName: actionGroupShortName
    enabled: true
    smsReceivers: [
      {
        name: 'contosoSMS'
        countryCode: '1'
        phoneNumber: '5555551212'
      }
      {
        name: 'contosoSMS2'
        countryCode: '1'
        phoneNumber: '5555552121'
      }
    ]
    emailReceivers: [
      {
        name: 'contosoEmail'
        emailAddress: 'devops@contoso.com'
        useCommonAlertSchema: true
      }
      {
        name: 'contosoEmail2'
        emailAddress: 'devops2@contoso.com'
        useCommonAlertSchema: true
      }
    ]
    webhookReceivers: [
      {
        name: 'contosoHook'
        serviceUri: 'http://requestb.in/1bq62iu1'
        useCommonAlertSchema: true
      }
      {
        name: 'contosoHook2'
        serviceUri: 'http://requestb.in/1bq62iu2'
        useCommonAlertSchema: true
      }
    ]
  }
}

output actionGroupId string = actionGroup.id

Parameter file

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
      "actionGroupName": {
        "value": "My Action Group"
      },
      "actionGroupShortName": {
        "value": "mygroup"
      }
  }
}

Next steps