Action Group Email Reciepient check and Subscribe feature

Chetan Goenka 30 Reputation points
2023-11-03T05:31:29.0066667+00:00

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

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 10,421 Reputation points
    2023-11-03T08:00:39.2133333+00:00

    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 "xxxxxx@yyyyyy.com"}| 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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.