1 min read

List all Azure resources with a specific tag


Finding resources by tag

When you have hundreds of resources across multiple resource groups it can be hard to find what you’re looking for. Tags to the rescue!

Find all resources with a specific tag name and value:

find_by_tag.sh
az resource list --tag environment=production --query "[].{Name:name, Type:type, RG:resourceGroup}" -o table

If you only care about the tag key (regardless of value):

find_by_tag_key.sh
az resource list --tag environment --query "[].{Name:name, Type:type, RG:resourceGroup}" -o table

Want to find resources that are missing a specific tag? Use Azure Resource Graph:

find_missing_tag.sh
az graph query -q "Resources | where tags !has 'environment' | project name, type, resourceGroup" -o table

Note: The az graph command requires the resource-graph extension. Install it with az extension add --name resource-graph.