Export Azure Resource Tags
One of Microsoft’s best practices is to ensure to add Tags (which are key:value pairs) to resources for accurate ownership tracking and cost management. Whether you apply tags to management groups, subscriptions, resource groups or resources, this ensures you can easily create reports based on these tags.
However, the accuracy of these reports is tied to the quality of the tag key and value names. Most organization, that do not use Azure Policies to help enforce the correct tagging strategy, have big difference in these key/value pairs.
To help get an overview of the missing tags on Azure resources I’ve created a PowerShell script that creates a CSV with tag key names as column name and the values below:

Script Usage
The script takes the resource type name as input and you can easily pipe all of the applicable resource types using a foreach statement. If you have no idea which resource types you have in Azure, you can also use the -allResourceTypes switch to let the script traverse all registered resource providers in your Azure tenant (but be aware that the script can take a long time to finish, since by default over 2000 resource providers are registered).
The script is able to export tags from:
- All Resources – All Resource Types using the -allResourceTypes switch
- All Resources – Single Resource Types using input parameter
- 1 Resource – Singel Resource Type using input parameters
Microsoft.Compute/virtualMachines
Microsoft.Network/virtualNetworks
The script exports the results per resource type to a .csv, so you will have 1 csv file per resource type:
All Resources
If you want to export tags for all resources from all resource types, you can add the -allResourceTypes when executing the script:
.\Export-AzureTags.ps1 -allResourceTypes

All Resources – Single Resource Type
If you want to export tags for all resources of a single resource type, you can execute the script as following:
.\Export-AzureTags.ps1 -resourceType Microsoft.Compute/virtualMachines

All Resources – Multiple Resource Type
If you want to export tags for all resources of multiple resource types, you can pipe them using a foreach statement. If you create a .csv with the resource type names (a sample .csv is on my GitHub account) you can quickly export the resource types required:
$resourceTypes = Import-Csv -Path <path to csv>
ForEach($type in $resourceTypes){
.\Export-AzureTags.ps1 -resourceType $type.resourceType
}

1 Resources – Single Resource Type
If you want to export tags for just 1 resource of a single resource type, you will need to supply the following:
- Resource Name
- Resource Type Name
- Resource Group Name
- Subscription Id
.\Export-AzureTags.ps1 -resourceName vnet-con-prd-westeurope-001 -resourceType Microsoft.Network/virtualNetworks -resourceGroupName rg-network-con-prd-001 -subscriptionId c4fcac9a-ab6c-43e2-80b0-83fbe6f12345

The script can be used to sign-in to Azure interactively or non-interactively. You can download the script from my GitHub account here.
Happy exporting!