Skip to content
Get Started for Free

Action Group

Azure Monitor Action Groups define a collection of notification preferences and actions to execute when an alert fires. Action Groups are referenced by alert rules such as metric alerts and activity log alerts. They support a variety of notification channels including email, SMS, voice calls, webhooks, and Azure Functions, making them the central dispatch mechanism for Azure Monitor alerts. For more information, see Create and manage action groups.

LocalStack for Azure provides a local environment for building and testing applications that make use of Azure Monitor Action Groups. The supported APIs are available on our API Coverage section, which provides information on the extent of Action Groups’ integration with LocalStack.

This guide walks you through creating an Action Group with an email receiver and associating it with an alert.

Launch LocalStack using your preferred method. For more information, see Introduction to LocalStack for Azure. Once the container is running, enable Azure CLI interception by running:

Terminal window
azlocal start-interception

This command points the az CLI away from the public Azure management REST API and toward the LocalStack for Azure emulator API. To revert this configuration, run:

Terminal window
azlocal stop-interception

This reconfigures the az CLI to send commands to the official Azure management REST API.

Create a resource group to hold all resources created in this guide:

Terminal window
az group create --name rg-monit-demo --location westeurope
Output
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monit-demo",
"location": "eastus",
"name": "rg-monit-demo",
"properties": { "provisioningState": "Succeeded" },
"type": "Microsoft.Resources/resourceGroups"
}

Create an action group with an email receiver as the notification endpoint:

Terminal window
az monitor action-group create \
--name my-action-group \
--resource-group rg-monit-demo \
--short-name myag \
--action email myemail admin@example.com
Output
{
"emailReceivers": [
{
"emailAddress": "admin@example.com",
"name": "myemail",
"useCommonAlertSchema": false
}
],
"groupShortName": "myag",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monit-demo/providers/microsoft.insights/actionGroups/my-action-group",
"name": "my-action-group",
"resourceGroup": "rg-monit-demo",
"type": "Microsoft.Insights/ActionGroups"
...
}

Retrieve the details of the action group, then list all action groups in the resource group:

Terminal window
az monitor action-group show \
--name my-action-group \
--resource-group rg-monit-demo
Output
{
"emailReceivers": [
{
"emailAddress": "admin@example.com",
"name": "myemail",
"useCommonAlertSchema": false
}
],
"groupShortName": "myag",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monit-demo/providers/microsoft.insights/actionGroups/my-action-group",
"name": "my-action-group",
"resourceGroup": "rg-monit-demo",
"type": "Microsoft.Insights/ActionGroups"
...
}

Then list all action groups in the resource group to confirm it appears:

Terminal window
az monitor action-group list \
--resource-group rg-monit-demo
Output
[
{
"emailReceivers": [
{
"emailAddress": "admin@example.com",
"name": "myemail",
"useCommonAlertSchema": false
}
],
"groupShortName": "myag",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monit-demo/providers/microsoft.insights/actionGroups/my-action-group",
"name": "my-action-group",
"resourceGroup": "rg-monit-demo",
"type": "Microsoft.Insights/ActionGroups"
}
]

Update the action group to add a second email receiver:

Terminal window
az monitor action-group update \
--name my-action-group \
--resource-group rg-monit-demo \
--add-action email newcontact ops@example.com
Output
{
"emailReceivers": [
{ "emailAddress": "admin@example.com", "name": "myemail", "useCommonAlertSchema": false },
{ "emailAddress": "ops@example.com", "name": "newcontact", "useCommonAlertSchema": false }
],
"groupShortName": "myag",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monit-demo/providers/microsoft.insights/actionGroups/my-action-group",
"name": "my-action-group",
"resourceGroup": "rg-monit-demo",
"type": "Microsoft.Insights/ActionGroups"
...
}

Delete the resource and confirm it no longer appears in the list:

Terminal window
az monitor action-group delete \
--name my-action-group \
--resource-group rg-monit-demo

Then list all action groups to confirm the resource group is now empty:

Terminal window
az monitor action-group list --resource-group rg-monit-demo
Output
[]
  • Action group lifecycle: Create, read, list, update, and delete action groups.
  • Email receivers: Define one or more email receiver addresses.
  • SMS receivers: Define SMS receiver phone numbers.
  • Webhook receivers: Define webhook receiver URLs (stored, not invoked).
  • Azure app push receivers: Define Azure app push notification receivers.
  • Voice receivers: Define voice notification receivers.
  • Logic app receivers: Define Logic App action receivers.
  • Azure function receivers: Define Azure Function receivers.
  • Event hub receivers: Define Event Hub receivers.
  • Short name support: Each action group has a short name (max 12 characters) for SMS and push notifications.
  • No notifications sent: Emails, SMS messages, voice calls, and push notifications are not dispatched when an alert is triggered.
  • No webhook invocation: Webhook URLs are stored but not called.
  • No Logic App or Azure Function invocation: Logic App and Azure Function actions are stored but not executed.
  • No test alert simulation: The az monitor action-group test command is not supported.

Explore end-to-end examples in the LocalStack for Azure Samples repository.

OperationImplemented
Page 1 of 0
Was this page helpful?