Azure Cost Management: Budgets, Tags, and Advisor
You will set a budget with alerts, tag resources for showback, and act on Azure Advisor recommendations. By the end you will catch overspend early and cut waste before the monthly bill arrives.
Learning Objectives
- Create a budget with threshold alerts.
- Tag resources to attribute cost by project.
- Apply Advisor cost recommendations.
- Time: ~2 hours · Difficulty: Beginner · Prereqs: an Azure subscription with some resources.
Architecture Overview
graph LR
Res[Tagged resources] --> CA[Cost Analysis]
CA --> B[Budget + alerts]
Adv[Azure Advisor] -->|recommendations| Act[Right-size / shut down]
Act --> Save[Lower spend]
Environment Setup
You will need: the Azure CLI and a subscription with billable resources.
Before you begin: agree a tagging convention (for example project, env).
Step-by-Step Execution
01
Tag resources for attribution
az resource tag --tags project=tyf env=lab --ids $(az resource list -g tyf-rg --query "[].id" -o tsv)02
Create a budget with alerts
az consumption budget create --budget-name tyf-monthly --amount 50 --time-grain Monthly --category Cost03
Review Advisor recommendations
$ az advisor recommendation list --category Cost -o table
Category Impact ShortDescription
Cost High Right-size or shut down underutilized VM
Progress So Far
graph LR
A[01 Tagging] -->|done| B[02 Budget]
B -->|done| C[03 Advisor]
style A fill:#1a4a1a,stroke:#00ff00,color:#fff
style B fill:#1a4a1a,stroke:#00ff00,color:#fff
style C fill:#1a4a1a,stroke:#00ff00,color:#fff
Testing & Validation
az consumption budget show --budget-name tyf-monthly --query amount && az resource list -g tyf-rg --query "[?tags.project=='tyf'] | length(@)"You should see the budget amount and a count of tagged resources. With Advisor reviewed, cost governance is in place.
Troubleshooting
- Budget alert not received: attach notification contacts/action groups to the budget.
- Costs unattributed: enforce tags with Azure Policy so new resources inherit them.
- Advisor empty: recommendations need usage history; check back after a day of activity.
Extension Ideas
- Auto-shutdown dev VMs on a schedule to cut idle cost.
- Export cost data and chart it in Azure Monitor workbooks.
- Detect anomalies as part of CSPM.
Key Results
- Set a monthly budget with threshold alerts.
- Tagged resources to attribute 100% of project cost.
- Surfaced Advisor recommendations to cut waste.
- Established proactive spend governance before billing.