How to add more than 1 action group to an Azure Alert using PowerShell ?

MS Techie 2,681 Reputation points
2021-09-09T17:37:16.037+00:00

How to add more than 1 action group to an Azure Alert using PowerShell ?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,812 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Monalla-MSFT 11,801 Reputation points
    2021-09-09T18:00:59.017+00:00

    @MS Techie - Thanks for reaching out.

    If you want to use action group, you need to create the new metric alert rule, its resource type is Microsoft.Insights/metricAlerts.

    For the new metric alert rule, I don't think there is any built-in PowerShell command, we need to use ARM template and New-AzResourceGroupDeployment to create it.

    Take a look at this document for more reference : Alert Metrics Create Template

    You can find the actions in the template, just specify the actionGroupId, you will be able to add the action group.

    "actions": [  
                        {  
                            "actionGroupId": "[parameters('actionGroupId')]"  
                        }  
                    ]  
    

    Hope this helps.

    If the above response helped, Please feel free to "Accept as Answer" so it can be beneficial to the community.