Lesson 1 of 2 Azure Cost Management and Advisor

Controlling Spending with Budgets and Cost Alerts

Microsoft Cost Management shows and forecasts spending. This lesson explains cost analysis, budgets and the different kinds of cost alerts.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe cost analysis views, including grouping by tag and amortized cost.
  • Explain budgets, their alert conditions and how action groups automate a response.
  • Distinguish between budget, anomaly and other cost alerts.

Cost analysis

Cost analysis shows accumulated and forecast costs for a scope (management group, subscription, resource group or billing scope). Views can be grouped and filtered by service, resource, resource group, location, meter or tag, switched between actual cost (purchases shown when they occur) and amortized cost (reservation purchases spread over their term), and saved or exported to a storage account on a schedule. Access is controlled by Azure roles such as Cost Management Reader and Cost Management Contributor, or by billing roles.

True or false

Reading cost analysis

Exam skills 1.3.6

Check how cost analysis views costs and who can see them.

Log in to try this activity Interactive activities are free with an account.

Budgets

A budget sets an amount for a scope over a reset period (monthly, quarterly or annually) with a start and expiry date, optionally filtered by resource group, service or tag. It has alert conditions at percentages of the budget, each based on actual cost (spending has happened) or forecasted cost (spending is predicted to reach the threshold), for example forecast at 90% and actual at 100%. Each condition emails recipients and can trigger an action group.

A budget never stops resources or spending by itself. To act automatically, connect the alert to an action group that runs an Azure Automation runbook, Logic App or function that, for example, shuts down development VMs. Cost data is updated several times a day, so budget evaluation has some delay. Budgets are created in the portal, with az consumption budget create, or in templates.

The following diagram shows a monthly budget's two alert conditions, one that notifies and one that acts.

A budget that notifies and acts. A monthly budget of 2,000 US dollars on the sandbox subscription has two alert conditions: forecasted cost at 80% emails the administrators, and actual cost at 100% triggers an action group that runs an Automation runbook to deallocate the VMs. A budget alone only notifies.
The scenario is illustrative.
Scenario questions

Designing a budget

Exam skills 1.3.6

Configure budgets and their alert conditions for each requirement.

Log in to try this activity Interactive activities are free with an account.

Other cost alerts

Cost Management offers other alert types besides budget alerts. The following table summarizes them.

AlertPurpose
Budget alertSpending or forecast reaches a percentage of a budget
Anomaly alertDaily cost changes unexpectedly for a subscription, detected by machine learning
Scheduled alertEmails a saved cost view on a schedule
Reservation utilization alertReservations are underused
Credit and department quota alertsEnterprise Agreement credit or department spending thresholds
Match the pairs

Kinds of cost alert

Exam skills 1.3.6

Match each requirement with the alert type that meets it.

Log in to try this activity Interactive activities are free with an account.
Worked example

Stopping a runaway sandbox

A sandbox subscription has a monthly allowance of 2,000 US dollars. Administrators want an email when the forecast reaches 80% of the allowance, and all VMs in the subscription must be deallocated automatically when actual spending reaches 100%. What should you configure?

Create a monthly budget of 2,000 on the subscription with two alert conditions: Forecasted at 80% with email recipients, and Actual at 100% linked to an action group that runs an Automation runbook to deallocate the VMs. The budget alone would only notify; an anomaly alert reacts to unusual changes, not to a fixed threshold.

Check yourself

Does a budget stop resources when spending reaches 100%?

Show answer

No. A budget only alerts; stopping resources needs an action group that runs automation such as a runbook.

Exam Tips

Remember for the exam

  • Budgets alert; they never stop resources unless an action group runs automation.
  • Alert before spending happens: a forecasted cost condition.
  • Budgets can be scoped to management groups, subscriptions and resource groups, and filtered by tag.
  • Unexpected spikes: cost anomaly alerts.