Building an Enforceable Tagging Strategy
This lesson explains how tags behave, what they should record, and how to keep them accurate.
Learning outcomes
After completing this lesson, you will be able to:
- Describe tag limits and inheritance behaviour.
- Identify useful types of tags.
- Explain how Azure Policy enforces and copies tags.
How tags behave
A tag is a name and value pair attached to a resource, resource group or subscription, as metadata. Tags have no effect on how a resource behaves. Their value lies in what can be done with them: filtering costs, finding resources, and driving automation.
Several behaviours shape a tagging design. Each resource, resource group or subscription can have up to 50 tag name and value pairs. A tag name can be up to 512 characters and a value up to 256, although storage accounts limit names to 128. Tag names are not case sensitive, but values are. Most importantly, resources do not inherit the tags of their resource group or subscription, so a tag on a resource group does not appear on the resources within it.
Tag rules
What tags should record
A tag strategy starts by asking what questions the organization must answer. The Cloud Adoption Framework groups useful tags by their purpose.
| Tag type | Example names | Question answered |
|---|---|---|
| Functional | app, env, tier | What is this resource, and what does it belong to? |
| Classification | confidentiality, criticality, sla | How must it be protected and supported? |
| Accounting | cost-centre, project, budget | Who pays for it? |
| Ownership | owner, business-unit, ops-team | Who is responsible for it? |
| Purpose | business-process, revenue-impact | Why does it exist? |
The list of required tags should be short, typically a handful. Each additional mandatory tag makes deployment more difficult and invites poor-quality data. Names and allowed values should be defined centrally, so that env=prod and environment=Production do not appear as separate categories in cost reports.
Which kind of tag?
Enforcing tags with Azure Policy
A tagging standard that relies on people remembering will fail, so Azure Policy should enforce it. Several built-in policy patterns are useful. Require a tag on resources uses the deny effect to reject deployments that lack the tag. Inherit a tag from the resource group uses the modify effect to copy the group's tag to its resources, closing the inheritance gap. A remediation task applies a modify policy to resources that existed before the assignment.
Deny policies should be introduced carefully, since they can block deployments that were not designed to include tags. A common route is to start with an audit effect to measure compliance, then move to modify or deny. Modify often gives a better experience than deny: a team sets a tag once on the resource group and every resource receives it automatically.
The following diagram shows the policies that produce a cost report by department with minimal change for developers.

Tags and cost management
Tags feed Microsoft Cost Management, in which costs can be grouped and filtered by tag to produce showback or chargeback reports. Not every cost record supports tags, and tags do not apply retrospectively to costs from before the tag was added, which means tagging should begin early. Tag inheritance in Cost Management can apply subscription and resource group tags to usage records for reporting purposes, without changing the resources themselves.
Tags are not a security mechanism. They are stored in plain text and appear in logs and billing data, so they must never contain secrets or personal data. ABAC conditions can evaluate tags on blobs, but tags should not otherwise be relied on for access control.
Tags and naming conventions
Tags and resource names both carry information, and a design should decide what belongs where. A name is fixed for the life of most resources, and it has to satisfy each resource type's length and character rules. It should therefore contain only stable facts, such as the resource type, the workload, the environment and the region, as in st-orders-prod-weu-001. A tag can be changed at any time, so it should carry facts that may change, such as the owning team or a cost centre.
The Cloud Adoption Framework recommends agreeing naming and tagging together, before large deployments begin, and enforcing both through Azure Policy where possible. Allowed values should be limited, using a policy parameter that lists the valid environments, for example, so that reports do not fragment into near-duplicate categories.
Name or tag?
Using tags for automation and operations
Tags also drive operations. A runbook can shut down virtual machines tagged for office hours, a backup policy can be applied through Azure Policy to machines with a given tag, and an update schedule can target machines by tag. Azure Resource Graph can query all resources in a tenant by tag, in seconds, which helps with inventory, audits and incident response, when a team must quickly find every resource belonging to an application.
Such uses raise the importance of accuracy, as an automation that depends on a wrong tag could stop the wrong server. A tag with operational effect should therefore be set by the deployment pipeline, and changes should be limited to people or processes that understand the effect, which can be arranged using the Tag Contributor role and Azure Policy.
Reporting costs by department
A university needs a monthly cost report by department. Each department has several resource groups, and developers often forget to add tags to new resources. Costs must be attributed with minimal change to how developers work. What should you recommend?
A required department tag on each resource group, enforced by a policy with a deny effect at resource group level, establishes the data. A built-in policy with the modify effect then copies the tag from the resource group to each resource, so developers need not do anything further, and a remediation task handles existing resources.
Requiring the tag on each resource would achieve the result, but it would disrupt developers and reject many deployments. Tagging only resource groups without inheritance would leave costs unattributed in resource-level reports. Separate subscriptions for each department could work, but restructuring is a much larger change than the requirement justifies.
Which policy effect copies a tag from a resource group to the resources in it?
Show answer
Modify, with a remediation task for resources that already exist.
Exam Tips
Remember for the exam
- Resources do not inherit tags without a policy or Cost Management tag inheritance.
- Keep required tags few, with defined names and values.
- Deny blocks untagged resources; modify copies tags; remediation fixes existing resources.
- Never put secrets or personal data in tags.