Costs: budgets, cost alerts and Azure Advisor
Azure III (the cost lesson, 31.26) found where an AKS platform's money goes and set a first budget. This lesson is the administrator's toolkit the AZ-104 asks about: how budgets and cost alerts reach people before the invoice does, and how Azure Advisor turns a subscription's telemetry into a to-do list. Advisor covers cost, but also reliability, security, performance and operational excellence, so for on-call it is also a list of risks.
Need to know:
- Cost Management is free and works at every scope you have Reader (or Cost Management Reader) on: management group, subscription, resource group, billing account. Cost analysis groups spend by service, resource, location or tag. Exports write the daily cost data to a storage account for your own reports.
- A budget has an amount, a reset period (monthly, quarterly, yearly), start and end dates and a scope. It never stops anything: it does not deallocate a VM or block a deploy. It sends alerts when spend crosses thresholds.
- Alert conditions per budget: a percentage of the amount, on actual cost (already spent) or forecasted cost (Azure's prediction for the period). Recipients: email addresses and action groups (the same Azure Monitor action groups that page on-call: email, SMS, webhook, Logic App, automation runbook).
- Cost data lags: usage shows up within 8-24 hours, so a budget alert can be a day late. A runaway cost needs a metric alert, not a budget.
Budgets that reach someone
$ az consumption budget create --budget-name try-lab-monthly --amount 1200 --time-grain Monthly --start-date 2026-09-01 --end-date 2027-08-31 --category Cost -o none
$ az consumption budget list --query "[].{name:name, amount:amount, grain:timeGrain, spent:currentSpend.amount}" -o table
Name Amount Grain Spent
--------------- ------ ------- -----
try-lab-monthly 1200.0 Monthly 0
The CLI's budget create sets the amount and period. The notifications (the part that matters) are set in the portal (Cost Management › Budgets › Alert conditions) or declared in Bicep/ARM. That is how teams keep them reviewed:
resource budget 'Microsoft.Consumption/budgets@2023-11-01' = {
name: 'payments-monthly'
properties: {
category: 'Cost'
amount: 4000
timeGrain: 'Monthly'
timePeriod: { startDate: '2026-10-01' }
notifications: {
actual80: {
enabled: true
operator: 'GreaterThan'
threshold: 80 // percent of the amount
thresholdType: 'Actual'
contactEmails: [ '[email protected]' ]
}
forecast100: {
enabled: true
operator: 'GreaterThan'
threshold: 100
thresholdType: 'Forecasted' // "we WILL go over this month"
contactGroups: [ actionGroup.id ] // page the team, not only finance
}
}
}
}
A good default: actual 50% and 80% to the team leads, forecasted 100% to the team's action group. The forecast alert is the one that arrives in week two, while there is still time to act.
Want a budget to do something? Point its action group at an automation runbook or Logic App that deallocates dev VMs or scales down. That is a choice you make, not something budgets do.
Other cost alerts
Cost Management shows these in one list (Cost alerts):
| Alert | Fires when |
|---|---|
| Budget | spend or forecast crosses a budget threshold |
| Anomaly | cost analysis sees an unusual daily change in a subscription (an anomaly alert rule emails you) |
| Credit | an Azure Prepayment (EA) credit runs low |
| Department spending quota | an EA department reaches its quota |
Azure Advisor
Advisor analyses your resources' configuration and usage and gives recommendations in five categories: Cost, Reliability (HighAvailability in the API), Security (fed from Defender for Cloud), Performance and Operational excellence. The Advisor score is the share of best practices you follow, per category.
$ az advisor recommendation list --query "[].{category:category, impact:impact, resource:impactedValue, problem:shortDescription.problem}" -o table
Category Impact Resource Problem
---------------- ------ ---------------------------------------- -------------------------------------------------------------
HighAvailability Medium stsysoplab Enable Soft Delete to protect your blob data
HighAvailability Medium sttfstatesysop Enable Soft Delete to protect your blob data
Cost Medium pvc-e41d9a07-5c2b-4f8e-b316-9a0d7c4e2b58 Review unattached disks
HighAvailability Medium vm-jump Enable Backups on your Virtual Machines
HighAvailability Medium vm-jump Use Availability zones for better resiliency and availability
Cost High vm-jump Right-size or shutdown underutilized virtual machines
$ az advisor recommendation list --category Cost --query "[].{resource:impactedValue, problem:shortDescription.problem, impact:impact}" -o table
Resource Problem Impact
---------------------------------------- ----------------------------------------------------- ------
pvc-e41d9a07-5c2b-4f8e-b316-9a0d7c4e2b58 Review unattached disks Medium
vm-jump Right-size or shutdown underutilized virtual machines High
- Each recommendation names the resource, the problem, the suggested solution and an impact (High, Medium, Low). Cost recommendations come with an estimated saving in the portal.
- Typical cost ones: right-size or shut down underutilised VMs (by default, average CPU under 5% over 7 days; the CPU threshold and lookback are configurable), delete unattached disks and idle public IPs, buy reservations or savings plans for steady usage.
- Advisor refreshes about once a day, or on demand from the portal. Fix the cause and the recommendation goes away at the next refresh.
When a recommendation is known and accepted (the jump box should be small and mostly idle), postpone it for a number of days or dismiss it, so the list stays a list of real work:
$ JUMP=$(az advisor recommendation list --category Cost --query "[?impactedValue=='vm-jump'].id" -o tsv)
$ az advisor recommendation disable --ids $JUMP --days 30
$ az advisor recommendation list --category Cost --query "[].impactedValue" -o tsv
pvc-e41d9a07-5c2b-4f8e-b316-9a0d7c4e2b58
Advisor alerts (Advisor › Alerts, or an activity log alert on the Recommendation category) tell a team when a new recommendation appears for their resources. Advisor digests email a summary on a schedule.
Cutting the bill, the short list
- Reservations (1 or 3 years, a specific VM family and region, the deepest discount) and savings plans for compute (an hourly spend commitment across families and regions): for the steady baseline only.
- Azure Hybrid Benefit: reuse existing Windows Server / SQL Server licences with Software Assurance on Azure VMs.
- Spot VMs for interruptible work, deallocate (not just stop) dev VMs at night: a stopped but allocated VM still pays for compute.
- Tags for showback, enforced by Azure Policy (earlier in this chapter), so every euro in cost analysis has an owner.
- The Pricing calculator estimates a design before you build it. The TCO calculator compares on-premises costs with Azure.
On the exam (AZ-104 1.3.6): budgets (scope, amount, reset period, actual vs forecasted alert conditions, action groups; budgets don't stop resources), cost alerts types, cost analysis by tag, Advisor's five categories, Advisor score, postpone and dismiss, the default "underutilised VM" rule.
In an interview: "How do you stop a team overspending in Azure?" - "Tags for owner and cost centre enforced by policy, so cost analysis shows who spends. A budget per team or subscription with an 80% actual alert to the leads and a forecasted 100% alert to the team's action group, so they hear about it in week two and not at the invoice. Advisor's cost recommendations reviewed weekly. A budget only alerts, it never stops anything. If something must stop, the action group calls an automation runbook."
What you can now do
- Create a budget and say which alert conditions and recipients make it useful.
- Name the cost alert types and what each fires on.
- Read Advisor by category, postpone an accepted recommendation, and list the main ways to cut cost.