So, I was with a customer and they are asking for a fairly standard alert.
“Please alert me when an NSG is added or modified”. Seems simply enough, however this is not as simply as you think. So I used my favourite search and found the following, “How to receive an email on Azure Network Security Group Rule changes“, this is great content and after testing, it works exactly as expected. I just found one little concern with this approach; this is simply finding the required ID for the action group. I have now investigated and found some code to make this a little easier.
AZ CLI
az monitor action-group list
PowerShell
Get-AzActionGroup
Hope this helps people in the field to find the Resource Group ID more easily.