OnCallReadyStart learning

Azure Lesson 32.19 · Azure IV: Governance, Storage & Backup · 14 min read

Costs: budgets, cost alerts and Azure Advisor

In plain words

A budget is a note on the fridge: "we planned 4,000 for this month; tell me when we've spent 80%, and warn me in week two if we're on track to go over." It never locks the fridge - it only sends messages.

Advisor is a friendly inspector who walks through the house every day and leaves a list: this light has been on for weeks in an empty room, this window has no lock, this heater is too big for the room.

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):

AlertFires when
Budgetspend or forecast crosses a budget threshold
Anomalycost analysis sees an unusual daily change in a subscription (an anomaly alert rule emails you)
Creditan Azure Prepayment (EA) credit runs low
Department spending quotaan 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.

Why it helps

Cloud bills arrive a month late and aggregated, so the team that caused a spike rarely sees it in time. Budgets with forecast alerts, cost analysis by tag and a weekly look at Advisor turn cost into something an on-call rotation can notice.

Advisor's reliability and security recommendations are also a free risk list: missing backups, missing soft delete, single points of failure.

Commands in this lesson

az

FAQ

Can a budget stop resources when it is exceeded?

No. A budget only sends alerts to emails and action groups. If something must be stopped, the action group can start an automation runbook or Logic App that deallocates or scales down what you choose.

Actual or forecasted alert?

Both. Actual thresholds (for example 50% and 80%) say how much is spent; a forecasted 100% alert fires when Azure predicts you will exceed the budget by the end of the period, usually early enough to act.

Why did the budget alert arrive a day late?

Cost data is processed with a delay of roughly 8-24 hours. Budgets are for trends, not real-time protection. A runaway resource needs a metric alert (on usage) to be caught within minutes. Cost anomaly alerts help too, but they work on the same delayed data.

What are Advisor's categories?

Cost, Reliability (HighAvailability in the API), Security (from Defender for Cloud), Performance and Operational excellence. The Advisor score shows the share of best practices you follow per category. Each recommendation has an impact (High, Medium, Low) and, for cost, an estimated saving.

Should I dismiss recommendations I disagree with?

Postpone or dismiss the ones you have decided on, with a note of why, so the list stays a list of real work. Postponing (az advisor recommendation disable --days N) brings it back later, which is better when the decision might change.

In an interview Mid

How do you stop a team from overspending in Azure?

Tags for owner and cost centre, enforced by policy, so cost analysis shows who spends what. 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 on the invoice. Advisor cost recommendations reviewed weekly: right-size or shut down idle VMs, delete unattached disks, buy reservations or savings plans for the steady baseline.

Also asked: What is the difference between a reservation and a savings plan? · What does Azure Advisor recommend, and how is it calculated? · What is the difference between stopping and deallocating a VM for cost?

Practise this lesson in the terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.