How-to guide

Set up cost allocation tags on Azure

Learn how to design Azure tag keys, enforce them with Azure Policy, apply them in code, and use them in Cost Management for showback and budgets.

By the Cloudverg engineering team · · 5 min read

Why this matters

Azure bills by subscription, resource group and resource. That structure rarely matches how a company buys: product, customer, team, environment. Tags add those business dimensions. A cost allocation tag is the small set of tags you trust enough to split money with. Pick too many and reports get thin. Pick too few and shared costs stay a mystery.

The useful work happens before the invoice. Decide which keys finance, engineering and operations will read the same way. The value must be predictable, not a sentence typed by whoever created the resource. A tag like env with values prod, stage and dev can drive a budget. A tag like notes cannot.

Tags also drive automation. Azure Policy can require them, scripts can report on them, and runbooks can find resources by them. Keep the cost schema separate from operational tags so a cleanup script does not rename the keys finance reports on.

Before you start

You need rights in three places. To tag resources, use Contributor, Tag Contributor or a custom role with Microsoft.Resources/tags/*. To assign policy, use Resource Policy Contributor at a management group, subscription or resource group scope. To read bills and create budgets, use Cost Management Reader or Cost Management Contributor.

Write the schema down before you touch the portal. Use lower camel case keys such as costCenter, ownerEmail, app, env and project. Keep the list short. Define allowed values and a fallback such as shared or unknown. Skip spaces and punctuation in keys if your CLI and export tools will handle them.

Check the resource types you run. Most support tags, but some do not, and a few have lower limits. Azure allows up to 50 tags per resource at the time of writing.

Decide where shared costs go. A hub network, firewall or central monitoring workspace may serve many apps. Give it an owner and a cost center, then plan a cost allocation rule for the rest. Do not force shared resources into a product tag just to fill a chart.

How to do it

Start in audit mode. Assign a policy that lists required tags but does not block deployment. Let it run while you fix the backlog. A deny policy on day one stops releases and pushes people around the process.

Put tags in the deployment path. If Bicep, Terraform or a portal template creates the resource, the template should carry the keys. Policy can fill gaps, but it cannot know which customer a resource serves. Policy is a guardrail. The request or service catalog is the source of truth.

After the backlog is clean, switch the high value keys to deny or modify. Keep reports for soft keys. Recheck monthly as new resource types and teams arrive. The goal is a bill you can split without a spreadsheet argument.

  1. Write the tag schema down. Create a short table with key, allowed values, owner and fallback. Put it in the same repo as your infrastructure code so it gets reviewed.
  2. Check current coverage. Use Azure Resource Graph Explorer to count resources missing each key. Save the query and run it before every policy change.
  3. Assign policy in audit mode. In Azure Policy, assign Require a tag on resources or a custom policy with the audit effect. Scope it to one subscription first.
  4. Tag from code and templates. Add a tags block to Bicep, Terraform and ARM templates. Make the pipeline fail when a required tag is empty.
  5. Backfill existing resources. Export the resource list, fill missing values from ownership records, and apply tags with Azure CLI. Test on one resource group before a subscription wide run.
  6. Enforce with deny or modify. Change the effect to deny for costCenter and ownerEmail. Use modify only when a resource group default is correct for every child.
  7. Build cost views and exports. In Cost Management, open Cost analysis, filter by tag, group by tag, and save the view. Schedule an export to storage for finance.
  8. Set budgets by tag. Create a budget at the subscription or resource group scope and add a tag filter. Send alerts to an action group a person watches.
  9. Review the split each month. Compare the tag report to the invoice and list the unassigned bucket. Fix the schema or the ownership record, not the chart.

How to check it worked

Open Azure Policy and check compliance for each assignment. A resource is compliant only when the key and an allowed value are present. Compliance lags changes, so use Resource Graph for a fresh count.

Run a query per key, for example Resources | where isnull(tags['costCenter']) | summarize count() by type. Replace the key for each check. Look at resource groups and subscriptions too if policy applies there.

In Cost Management, group cost by costCenter and by app. The report should show a small unassigned slice, not a large gray block. Missing keys do not hide cost. The cost lands outside the split.

Open the export file and check the tag columns. Confirm the budget filter returns the resources you expect. Check the action group with a low threshold test if your process allows it. Repeat after the first full billing cycle.

Mistakes to avoid

A schema that grows every sprint is the first problem. Every key adds a column and a meeting. Keep the cost schema to five keys or fewer. The second is assuming inheritance. Azure does not copy tags from a subscription or resource group to a child by default. Use policy to inherit or append, and test the modify effect on a small scope.

Free text is the third. prod, Prod and production become three lines. Use allowed values and a pull request to change the list.

Leaving shared costs out is the fourth. A tag on an app VM does not split the hub network or the log workspace. Add cost allocation rules, or assign shared resources to a platform cost center and show them as a line item.

If the schema keeps drifting, a fixed scope review can help. Cloudverg's Cloud cost audit at $4,500/month covers tagging and budget alert fixes along with rightsizing and commitment planning. It is one option among others, and it works best when you already own the schema.

Frequently asked questions

Do Azure tags inherit from resource groups or subscriptions?

No. Azure applies tags to the resource where you set them. Use Azure Policy with the modify effect, such as Inherit a tag from the resource group if missing, to copy a default down. Test the assignment because policy changes can take time to remediate.

Are Azure tag names case sensitive?

Tag names are case insensitive, so CostCenter and costcenter refer to the same key. Tag values are case sensitive, so Prod and prod are different values in reports. Pick one casing and enforce it with allowed values.

How long before tags show up in Azure Cost Management?

Tag changes do not appear on the bill at once. Cost and tag data have a lag, often a day or more, and the current month can change as data arrives. Use Resource Graph for immediate coverage checks and Cost Management for the money view.

Monthly plan

Want help with this? Cloud cost audit

$4,500/month

2 weeks · Starts within 10 business days

A two-week, read-only review of your AWS, Azure, Google Cloud or Oracle bill, with every saving ranked by dollars per month.

Renews monthly. Cancel any time.
What is included

Related guides

More cloud costs guides   Cloud cost audit

Smallest way to start

Get a senior architect on your problem this week

Ninety minutes a month on the cloud, AI or security question that is blocking you, a pre-read of your material and a written summary within two business days.

$450/month

Renews monthly. Cancel any time.