Azure Monitor Action Group
This page shows how to write Terraform and Azure Resource Manager for Monitor Action Group and write them securely.
azurerm_monitor_action_group (Terraform)
The Action Group in Monitor can be configured in Terraform with the resource name azurerm_monitor_action_group. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_monitor_action_group" "myag" {
name = var.name
resource_group_name = var.resource_group_name
short_name = var.short_name
email_receiver {
name = var.addreser_name
resource "azurerm_monitor_action_group" "email" {
name = "PagoPA"
resource_group_name = azurerm_resource_group.monitor_rg.name
short_name = "PagoPA"
email_receiver {
resource "azurerm_monitor_action_group" "email" {
name = "EmailPagoPA"
resource_group_name = data.azurerm_resource_group.monitor_rg.name
short_name = "EmailPagoPA"
email_receiver {
resource "azurerm_monitor_action_group" "TFAAlert" {
name = "example-actiongroup"
resource_group_name = azurerm_resource_group.TFAAlert.name
short_name = "p0action"
webhook_receiver {
resource "azurerm_monitor_action_group" "monitor" {
name = var.service_settings.name
resource_group_name = var.context.resource_group_name
short_name = var.service_settings.short_name
### For sending an email on alert
resource "azurerm_monitor_action_group" "pip-action-group" {
name = "pip-support"
resource_group_name = var.resource_group
short_name = "pip-support"
email_receiver {
resource "azurerm_monitor_action_group" "action_group" {
name = var.action_group_name
resource_group_name = data.azurerm_resource_group.rg.name
short_name = var.action_group_short_name
email_receiver {
resource "azurerm_monitor_action_group" "monitor-action-grp" {
name = "CriticalAlertsAction"
resource_group_name = azurerm_resource_group.main.name
short_name = "serviceissue"
arm_role_receiver {
resource "azurerm_monitor_action_group" "email" {
name = "PagoPA"
resource_group_name = azurerm_resource_group.monitor_rg.name
short_name = "PagoPA"
email_receiver {
resource "azurerm_monitor_action_group" "main" {
name = var.name
resource_group_name = data.azurerm_resource_group.rg.name
short_name = var.name
email_receiver {
Parameters
-
enabledoptional - bool -
idoptional computed - string -
namerequired - string -
resource_group_namerequired - string -
short_namerequired - string -
tagsoptional - map from string to string -
arm_role_receiverlist block-
namerequired - string -
role_idrequired - string -
use_common_alert_schemaoptional - bool
-
-
automation_runbook_receiverlist block-
automation_account_idrequired - string -
is_global_runbookrequired - bool -
namerequired - string -
runbook_namerequired - string -
service_urirequired - string -
use_common_alert_schemaoptional - bool -
webhook_resource_idrequired - string
-
-
azure_app_push_receiverlist block-
email_addressrequired - string -
namerequired - string
-
-
azure_function_receiverlist block-
function_app_resource_idrequired - string -
function_namerequired - string -
http_trigger_urlrequired - string -
namerequired - string -
use_common_alert_schemaoptional - bool
-
-
email_receiverlist block-
email_addressrequired - string -
namerequired - string -
use_common_alert_schemaoptional - bool
-
-
itsm_receiverlist block-
connection_idrequired - string -
namerequired - string -
regionrequired - string -
ticket_configurationrequired - string -
workspace_idrequired - string
-
-
logic_app_receiverlist block-
callback_urlrequired - string -
namerequired - string -
resource_idrequired - string -
use_common_alert_schemaoptional - bool
-
-
sms_receiverlist block-
country_coderequired - string -
namerequired - string -
phone_numberrequired - string
-
-
timeoutssingle block -
voice_receiverlist block-
country_coderequired - string -
namerequired - string -
phone_numberrequired - string
-
-
webhook_receiverlist block-
namerequired - string -
service_urirequired - string -
use_common_alert_schemaoptional - bool -
aad_authlist block-
identifier_urioptional computed - string -
object_idrequired - string -
tenant_idoptional computed - string
-
-
Explanation in Terraform Registry
Manages an Action Group within Azure Monitor.
Tips: Best Practices for The Other Azure Monitor Resources
In addition to the azurerm_monitor_log_profile, Azure Monitor has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_monitor_log_profile
Ensure to enable the activity retention log
It is better to enable the activity retention log to ensure that all the information required for an effective investigation is still available.
Microsoft.Insights/actionGroups (Azure Resource Manager)
The actionGroups in Microsoft.Insights can be configured in Azure Resource Manager with the resource name Microsoft.Insights/actionGroups. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.Insights/actionGroups",
"apiVersion": "2017-04-01",
"location": "Global",
"name": "TEST Action Group - SMS only",
"properties": {
"groupShortName": "SMSOnly",
"type": "Microsoft.Insights/actionGroups",
"apiVersion": "2017-03-01-preview",
"location": "Global",
"name": "TEST Action Group - SMS only",
"properties": {
"groupShortName": "SMSOnly",
"type": "Microsoft.Insights/actionGroups",
"apiVersion": "2017-04-01",
"name": "AzSKAlertActionGroup",
"location": "Global",
"properties": {
"groupShortName": "AzSKAG",
"type": "Microsoft.Insights/actionGroups",
"location": "global",
"apiVersion": "2018-03-01",
"properties": {
"groupShortName": "Create Issue",
"enabled": true,
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"actionGroups_health_notification_group_name": {
Parameters
apiVersionrequired - stringlocationrequired - stringResource location
namerequired - stringThe name of the action group.
propertiesrequiredarmRoleReceiversoptional arraynamerequired - stringThe name of the arm role receiver. Names must be unique across all receivers within an action group.
roleIdrequired - stringThe arm role id.
useCommonAlertSchemaoptional - booleanIndicates whether to use common alert schema.
automationRunbookReceiversoptional arrayautomationAccountIdrequired - stringThe Azure automation account Id which holds this runbook and authenticate to Azure resource.
isGlobalRunbookrequired - booleanIndicates whether this instance is global runbook.
nameoptional - stringIndicates name of the webhook.
runbookNamerequired - stringThe name for this runbook.
serviceUrioptional - stringThe URI where webhooks should be sent.
useCommonAlertSchemaoptional - booleanIndicates whether to use common alert schema.
webhookResourceIdrequired - stringThe resource id for webhook linked to this runbook.
azureAppPushReceiversoptional arrayemailAddressrequired - stringThe email address registered for the Azure mobile app.
namerequired - stringThe name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group.
azureFunctionReceiversoptional arrayfunctionAppResourceIdrequired - stringThe azure resource id of the function app.
functionNamerequired - stringThe function name in the function app.
httpTriggerUrlrequired - stringThe http trigger url where http request sent to.
namerequired - stringThe name of the azure function receiver. Names must be unique across all receivers within an action group.
useCommonAlertSchemaoptional - booleanIndicates whether to use common alert schema.
emailReceiversoptional arrayemailAddressrequired - stringThe email address of this receiver.
namerequired - stringThe name of the email receiver. Names must be unique across all receivers within an action group.
useCommonAlertSchemaoptional - booleanIndicates whether to use common alert schema.
enabledrequired - booleanIndicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications.
eventHubReceiversoptional arrayeventHubNamerequired - stringThe name of the specific Event Hub queue
eventHubNameSpacerequired - stringThe Event Hub namespace
namerequired - stringThe name of the Event hub receiver. Names must be unique across all receivers within an action group.
subscriptionIdrequired - stringThe Id for the subscription containing this event hub
tenantIdoptional - stringThe tenant Id for the subscription containing this event hub
useCommonAlertSchemaoptional - booleanIndicates whether to use common alert schema.
groupShortNamerequired - stringThe short name of the action group. This will be used in SMS messages.
itsmReceiversoptional arrayconnectionIdrequired - stringUnique identification of ITSM connection among multiple defined in above workspace.
namerequired - stringThe name of the Itsm receiver. Names must be unique across all receivers within an action group.
regionrequired - stringRegion in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'
ticketConfigurationrequired - stringJSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well.
workspaceIdrequired - stringOMS LA instance identifier.
logicAppReceiversoptional arraycallbackUrlrequired - stringThe callback url where http request sent to.
namerequired - stringThe name of the logic app receiver. Names must be unique across all receivers within an action group.
resourceIdrequired - stringThe azure resource id of the logic app receiver.
useCommonAlertSchemaoptional - booleanIndicates whether to use common alert schema.
smsReceiversoptional arraycountryCoderequired - stringThe country code of the SMS receiver.
namerequired - stringThe name of the SMS receiver. Names must be unique across all receivers within an action group.
phoneNumberrequired - stringThe phone number of the SMS receiver.
voiceReceiversoptional arraycountryCoderequired - stringThe country code of the voice receiver.
namerequired - stringThe name of the voice receiver. Names must be unique across all receivers within an action group.
phoneNumberrequired - stringThe phone number of the voice receiver.
webhookReceiversoptional arrayidentifierUrioptional - stringIndicates the identifier uri for aad auth.
namerequired - stringThe name of the webhook receiver. Names must be unique across all receivers within an action group.
objectIdoptional - stringIndicates the webhook app object Id for aad auth.
serviceUrirequired - stringThe URI where webhooks should be sent.
tenantIdoptional - stringIndicates the tenant id for aad auth.
useAadAuthoptional - booleanIndicates whether or not use AAD authentication.
useCommonAlertSchemaoptional - booleanIndicates whether to use common alert schema.
tagsoptional - stringResource tags
typerequired - string
Frequently asked questions
What is Azure Monitor Action Group?
Azure Monitor Action Group is a resource for Monitor of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Monitor Action Group?
For Terraform, the ukpillai89/terrform, pagopa/selfcare-infra and pagopa/io-infra source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the chironconsulting/ARM-Schema-Templates, chironconsulting/ARM-Schema-Templates and arvindsingh-cloud/azsk source code examples are useful. See the Azure Resource Manager Example section for further details.