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.

The script gives you a CSV output report with:

  • All the resources in your Azure Subscription
  • Type of each resource, so that you can filter on various types
  • Tags for each of the resource in Azure

The Columns in the Output CSV file (generated by the script) are:

  1. Semi-colon separated list of tags
  2. Resource Name
  3. Resource Group Name
  4. Location
  5. Resource Type
  6. Resource Id
  7. Name
  8. Subscription Id

You can find this script on GitHub here: Azure Resources Report by Tags

Direct Link to the Script here. Right click and choose Save As

You are welcome to make changes and submit Pull Requests to this script or even fork and make your modifications.

Comments powered by Disqus