Script Sample - Generate Azure Resources Report by Tags

@20aman
Jan 26, 2017

<<Update: This post and the sample script is now updated to support latest Azure PowerShell cmdlets>>

When managing resources in Azure, Tags are there to help you. They add very valuable metadata to the Azure resources.
In nutshell, tags are Key-Value pairs. E.g. "Business Unit = Finance", "Site = Central US" are two such tags.

These tags help you to:

Organize your resources and manage the same

Get insights into Chargeback categorically

Tags go beyond the boundaries of deployments. You can have few resources deployed in one resource group and few other resources into the second resource group. If for these resources in both the resource groups you apply the same tag (i.e. same Key and value combination) then you can view and manage these resources in a single click.

Now once in a while, you want to take a health check of your Azure environment. You want to see what all resources are there and what are the tags applied to these resources. You want to extract this data to a CSV file so that you can apply filters and perform other business intellegence (BI) operations on it. The script below provides exactly that.