Skip to main content

Azure tagging strategy, part 1: what to tag, what not, and where tags can live

· 8 min read
Shpend Kelmendi
Software Engineer & Architect

Tags without a strategy grow wild: inconsistent spellings, no cost attribution and slow incident routing. This is part 1 of 3. It follows one question: which question does a tag answer, and where can it live? It covers Azure's limits, the control plane vs. data plane boundary, what not to tag, and which implementation option fits. Part 2 shows how we generate the tags with Terraform and use them for incident routing. Part 3 covers Databricks, Microsoft Fabric and cost per data product.

TL;DR
  • Tag what causes cost or incidents. Azure tags are control-plane metadata on Azure Resource Manager (ARM) resources. Tag data-plane objects such as Key Vault secrets only when a defined process reads that metadata.
  • Every tag needs a named reader. A tag that no report, policy or process reads has no value and nobody will maintain it.
  • Identity goes in the name, mutable context in tags. Changing a tag is an in-place update; a rename means recreating the resource.
  • Let IaC write the tags and Azure Policy audit them. A Modify policy and Terraform overwrite each other's changes.
Series: Azure tagging strategy for a data platform

The problem​

Every Azure estate starts the same way: someone adds env = dev to a storage account, someone else adds Environment = Development to a Key Vault, and a third person adds stage = DEV to a Databricks workspace. Six months later, the cost report has three "environment" columns and none of them adds up.

On a data platform with 30+ data products the problem multiplies:

  • Inconsistent spelling. owner, Owner, product-owner. Tag names are case-insensitive in Azure, but humans, scripts and reports are not.
  • No cost attribution. The invoice says "Azure Databricks: CHF X". Which product caused it? Nobody knows.
  • Slow incidents. An alert fires on st-xyz-prd-001. Which service is affected? Who is on call? Is it business critical? The on-call engineer starts a chat thread instead of fixing the issue.

Why tag, and when not​

Tags answer questions that a resource name can't, or shouldn't:

PurposeQuestion the tag answersExample tagIn our mandatory set?
Incident managementWhich service is affected? Who is responsible?itsm-level-1, itsm-level-2, itsm-level-3Yes, read by the ITSM integration
Cost controlWho pays? Which product or cost center?data-product, cost-centerdata-product yes, read by Cost Management and Databricks billing; cost-center no, nothing reads it
LifecycleProd or sandbox? How was it created?env, managed-byYes: Cost Management views and budgets split by env (prod vs. non-prod); a scheduled Resource Graph query flags resources without managed-by = terraform
Severity / SLAHow fast must we react?criticalityNo, ITSM holds priority per service
ConfidentialityHow sensitive is the data in this resource?data-classificationNo, no process reads it today

The table is a menu, not a checklist. A tag becomes mandatory only when a named report, policy or process reads it. criticality or data-classification earn their place the day something consumes them, not before.

Tags are metadata, not access control. A confidential tag protects nothing.

Tags vs. naming: mutable context (owner, cost, ITSM, classification) goes only in tags. Changing a tag is an in-place update; a rename means recreating the resource. Immutable identity (workload, environment, region, resource type) goes in the name. It goes in a tag as well only when a named reader must filter or group by it. Cost Management can't group by a part of a name, and Databricks cluster VMs don't carry your naming convention at all. That's why env is a tag and region isn't. For how tags compare with resource groups, subscriptions and management groups as grouping mechanisms, see Practical guide to organizing Azure resources.

What is possible: limits​

LimitValue
Tag name/value pairs per resource, resource group, subscription50 (a few types, such as Automation and DNS zones, only 15)
Tag name length512 characters (storage accounts: 128)
Tag value length256 characters
Forbidden characters in tag names< > % & \ ? /
Case sensitivityNames case-insensitive, values case-sensitive
Inheritance from resource group or subscriptionNone by default

Not every resource type supports tags, and not every tag reaches the cost report. The tag support reference lists both per type. Databricks adds stricter character rules (Part 3).

Control plane vs. Data plane​

Azure distinguishes two kinds of operations:

  • Control plane: managing resources through ARM (management.azure.com). Azure resource tags live here and are available to authorized inventory and ITSM integrations; billing support depends on the resource type.
  • Data plane: working with what is inside a resource: secrets in a Key Vault, blobs in a storage account. Access uses service-specific endpoints and permissions, separate from ARM access.

Key Vault makes the boundary explicit: control-plane read access lets you inspect the vault's properties and ARM tags without granting access to secret values. An ITSM integration can use that metadata to route vault-level incidents; retrieving secret metadata is a separate integration decision, not an automatic consequence of tagging the vault.

ObjectPlaneAzure tags?Useful for cost / ITSM?Tag it?
Storage account, Key Vault, Event Hubs namespace, Databricks workspaceControlYesYes, with supported billing and configured incident routingYes, the agreed resource tag set
Event hub, consumer groupControl (child resource)NoOnly through the parentNo, the parent carries the tags
Key Vault secretDataOwn secret tags (max. 15), not in the cost reportNot a billing dimension; per-secret routing needs explicit integrationOnly if a process reads them, e.g. rotation automation
Blob, Unity Catalog table, Fabric itemData / platformNo, own metadataRequires service-specific metadata integrationOnly for a concrete governance or operational use case

The question for a data-plane object is never "can I tag it?" but "who reads the tag?". Blind tagging creates maintenance work and no value.

What to tag, and what not​

Do tag every cost-bearing ARM resource with the tags that pass this filter, and nothing else. For us that is environment, the ITSM hierarchy, the data product and managed-by. managed-by also applies to resources created by IaC such as Terraform: managed-by = terraform tells everyone that portal changes will be overwritten by the next deployment.

Why secrets and personal data stay out
  • Secrets, keys or connection strings: tags are plain text, readable with Reader rights and copied into cost exports, deployment history and logs.
  • Personal names or email addresses: people leave, and it's personal data.

Implementation options​

OptionHowProsCons
Manual (portal, CLI)People add tags by handZero setupDrifts within weeks; typos
Azure PolicyBuilt-ins such as Require a tag on resources (deny), Inherit a tag from the resource group if missing and Add or replace a tag on resources (modify + remediation)Covers everyone, including portal clicksModify fights with IaC; limited logic
IaC (Terraform)Tags computed in code and reviewed in PRsVersioned, testable, consistentOnly covers resources deployed by IaC
IaC + Policy (audit)Terraform sets tags; Policy only audits or deniesBest of both; no drift loopTwo places to maintain

Why Modify fights with IaC: the policy adds tags outside Terraform, the next plan shows a diff and removes them again. If you need Modify, keep it away from IaC-managed scopes, or add lifecycle { ignore_changes = [tags] } deliberately and document why.

No default_tags in azurerm

Unlike the AWS provider, azurerm has no provider-level default_tags(Open issue). Every resource needs an explicit tags = .... That gap is the main reason to put tag generation into a central module (Part 2).

One definition, a list of required tags per assignment. We assign it twice: the five ITSM and lifecycle tags on the whole platform, plus data-product, assigned at the scope of the product resource groups so that it applies to the resources inside them. Shared platform resources don't carry data-product (Part 2 explains why). Audit by default, switch to Deny per assignment. mode: Indexed only evaluates resource types that support tags and location, so event hubs or consumer groups don't show up as non-compliant. Resource groups aren't evaluated in this mode either. The JSON shows the parts you pass to Terraform or the Azure CLI (mode, parameters and policyRule), not a full exported definition.

policy-definition.json
{
"mode": "Indexed",
"parameters": {
"tagNames": {
"type": "Array",
"defaultValue": ["env", "itsm-level-1", "itsm-level-2", "itsm-level-3", "managed-by"]
},
"effect": {
"type": "String",
"allowedValues": ["Audit", "Deny", "Disabled"],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"not": {
"count": {
"value": "[parameters('tagNames')]",
"name": "tagName",
"where": { "field": "tags", "containsKey": "[current('tagName')]" }
},
"equals": "[length(parameters('tagNames'))]"
}
},
"then": { "effect": "[parameters('effect')]" }
}
}

How this fits CAF and WAF​

  • Cloud Adoption Framework: Define your tagging strategy groups tags into functional, classification, accounting, purpose and ownership categories, and recommends starting with a small mandatory set that you enforce.
  • Well-Architected Framework, Cost Optimization (CO:03) relies on consistent tags to attribute spend to workloads and owners.
  • WAF service guide for Microsoft Fabric recommends tagging standards to make ownership and cost accountability visible.
  • Cost Management tag inheritance copies subscription and resource group tags onto usage records for reporting only. It's a safety net, not a replacement for tagging resources.

Next: implementation​

Part 2 turns these decisions into code: a Terraform module that generates the tags, and an ITSM service tree that gives them a reader. Continue with part 2.

Further Readings​