Sampel templat Resource Manager untuk grup tindakan di Azure Monitor

Artikel ini menyertakan sampel templat Azure Resource Manager untuk membuat grup tindakan di Azure Monitor. Setiap sampel menyertakan file templat dan file parameter dengan nilai sampel yang akan disediakan ke templat.

Catatan

Lihat Sampel Azure Resource Manager untuk Azure Monitor untuk daftar sampel yang tersedia dan panduan tentang menyebarkannya di langganan Azure Anda.

Buat grup tindakan

Sampel berikut membuat grup tindakan.

File templat

@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

File parameter

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

Langkah berikutnya