Identify Untagged Resources
Tagging in Azure is essential for managing resouces, billing, ownership and more. As a general rule it's important to ensure that all resources are tagged.
To identify untagged resources we can use the Resource Graph Explorer in Azure. This allows us to query across all our resources and filter for those that do not have tags.
Query for Untagged Resources
- Navigate to the Azure Portal and open the Resource Graph Explorer.
- Use the following Kusto Query Language (KQL) query to find untagged resources:
kql
resources
| where isnull(tags) or tostring(tags) == '[]'
| project name, type, resourceGroup, locationRecording management
Personally I like to tag all resources with a managed_by tag to indicate who or what is responsible for creating/updating the resource (e.g. manual or terraform or pulumi etc).
To identify resources that are not tagged with managed_by we can use the following query:
kql
resources
| where tags !has 'managed_by'
| project name, type, resourceGroup, location