|
| 1 | +--- |
| 2 | +title: Resource Manager template samples for action groups |
| 3 | +description: Sample Azure Resource Manager templates to deploy Azure Monitor action groups. |
| 4 | +ms.subservice: logs |
| 5 | +ms.topic: sample |
| 6 | +author: bwren |
| 7 | +ms.author: bwren |
| 8 | +ms.date: 05/18/2020 |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +# Resource Manager template samples for action groups in Azure Monitor |
| 13 | +This article includes sample [Azure Resource Manager templates](../../azure-resource-manager/templates/template-syntax.md) to create [action groups](../platform/action-groups.md) in Azure Monitor. Each sample includes a template file and a parameters file with sample values to provide to the template. |
| 14 | + |
| 15 | +[!INCLUDE [azure-monitor-samples](../../../includes/azure-monitor-resource-manager-samples.md)] |
| 16 | + |
| 17 | +## Create an action group |
| 18 | +The following sample creates an action group. |
| 19 | + |
| 20 | + |
| 21 | +### Template file |
| 22 | + |
| 23 | +```json |
| 24 | +{ |
| 25 | + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", |
| 26 | + "contentVersion": "1.0.0.0", |
| 27 | + "parameters": { |
| 28 | + "actionGroupName": { |
| 29 | + "type": "string", |
| 30 | + "metadata": { |
| 31 | + "description": "Unique name within the resource group for the Action group." |
| 32 | + } |
| 33 | + }, |
| 34 | + "actionGroupShortName": { |
| 35 | + "type": "string", |
| 36 | + "metadata": { |
| 37 | + "description": "Short name up to 12 characters for the Action group." |
| 38 | + } |
| 39 | + } |
| 40 | + }, |
| 41 | + "resources": [ |
| 42 | + { |
| 43 | + "type": "Microsoft.Insights/actionGroups", |
| 44 | + "apiVersion": "2018-03-01", |
| 45 | + "name": "[parameters('actionGroupName')]", |
| 46 | + "location": "Global", |
| 47 | + "properties": { |
| 48 | + "groupShortName": "[parameters('actionGroupShortName')]", |
| 49 | + "enabled": true, |
| 50 | + "smsReceivers": [ |
| 51 | + { |
| 52 | + "name": "contosoSMS", |
| 53 | + "countryCode": "1", |
| 54 | + "phoneNumber": "5555551212" |
| 55 | + }, |
| 56 | + { |
| 57 | + "name": "contosoSMS2", |
| 58 | + "countryCode": "1", |
| 59 | + "phoneNumber": "5555552121" |
| 60 | + } |
| 61 | + ], |
| 62 | + "emailReceivers": [ |
| 63 | + { |
| 64 | + "name": "contosoEmail", |
| 65 | + "emailAddress": "[email protected]" |
| 66 | + }, |
| 67 | + { |
| 68 | + "name": "contosoEmail2", |
| 69 | + "emailAddress": "[email protected]" |
| 70 | + } |
| 71 | + ], |
| 72 | + "webhookReceivers": [ |
| 73 | + { |
| 74 | + "name": "contosoHook", |
| 75 | + "serviceUri": "http://requestb.in/1bq62iu1" |
| 76 | + }, |
| 77 | + { |
| 78 | + "name": "contosoHook2", |
| 79 | + "serviceUri": "http://requestb.in/1bq62iu2" |
| 80 | + } |
| 81 | + ] |
| 82 | + } |
| 83 | + } |
| 84 | + ], |
| 85 | + "outputs":{ |
| 86 | + "actionGroupId":{ |
| 87 | + "type":"string", |
| 88 | + "value":"[resourceId('Microsoft.Insights/actionGroups',parameters('actionGroupName'))]" |
| 89 | + } |
| 90 | + } |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +### Parameter file |
| 95 | + |
| 96 | +```json |
| 97 | +{ |
| 98 | + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", |
| 99 | + "contentVersion": "1.0.0.0", |
| 100 | + "parameters": { |
| 101 | + "actionGroupName": { |
| 102 | + "value": "My Action Group" |
| 103 | + }, |
| 104 | + "actionGroupShortName": { |
| 105 | + "value": "mygroup" |
| 106 | + } |
| 107 | + } |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | +## Next steps |
| 114 | + |
| 115 | +* [Get other sample templates for Azure Monitor](resource-manager-samples.md). |
| 116 | +* [Learn more about action groups](../platform/action-groups.md). |
| 117 | + |
0 commit comments