Check all Azure Resources in a Azure Resource Group for the presence of a configured Alert Rule with PowerShell.

I have had a slew of Resource Group questions coming in lately and just as many of those being about Alert Rules. So I am working on few posts/scripts right now around these topics. This script checks all Azure Resources in a given Azure Resource Group for the presence of a configured Alert Rule and reports the status for each Resource. This script does not check for multiple Alert Rules, simply the presence of one or none as that was the request given to me.
 
You could easily edit this script to list out rules per resource, output as a grouped hashtable or lots of other fun customization. Please don't hesitate to request for customization or ask questions. Below is the script for copy or download full script from Microsoft Script Center.

 

 
Full script published to Microsoft Script Center:

https://gallery.technet.microsoft.com/scriptcenter/Check-all-resources-in-a-93316a74