Action Group Email Reciepient check and Subscribe feature

Chetan Goenka 30 Reputation points

I have a scenario where we have 200+ Action Groups (AGs), is there an easy way to query across all AGs if a particular email is present or not and whether a user is subscribed or unsubscribed? Also I want to remove one particular email if found to be removed across all AGs?

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,488 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 9,696 Reputation points

    Hi @Chetan Goenka ,

    If you are familiar with PowerShell then you could use Get-AzActionGroup and Set-AzActionGroup Az PowerShell cmdlets to accomplish your requirement.

    First for a simple validation purpose, you could get all action groups with particular email address as shown below.

    Get-AzActionGroup | ?{$_.EmailReceivers.EmailAddress -eq ""}| Select Name, @{E={$_.EmailReceivers.EmailAddress};L="EmailAddress"}, @{E={$_.EmailReceivers.Status};L="Status"}

    Then, you could come up with a script to get all action groups in your Azure subscription using Get-AzActionGroup cmdlet and then iterate through each action group using foreach loop and further iterate through each email receiver in the action group using another foreach loop inside it and check if the email receiver's email address matches the target email address and using Set-AzActionGroup cmdlet update the action group with the updated email receivers.

    If you are not familiar with PowerShell then you could try the same approach using Az CLI or Az REST API or any supported SDK as well.