This chapter covers Azure Cost Management and Billing Analysis, a critical topic for the AZ-104 exam that typically appears in 5–10% of questions. You will learn how to configure and use Azure Cost Management tools to monitor, analyze, and control spending across subscriptions and resource groups. The exam focuses on your ability to implement budgets, alerts, cost allocation using tags, and export cost data for external analysis. Mastering these skills ensures you can optimize cloud costs and prevent unexpected bills in production environments.
Jump to a section
Imagine you are the budget officer for a large corporation with multiple departments (subscriptions) and teams (resource groups). Each department has its own budget, and every purchase (resource creation) must be tracked and charged to the correct department. You use a system where every expense is tagged with a cost center (tag), and you have a central dashboard showing spending trends, forecasts, and anomalies. You also set up alerts when a department exceeds 80% of its monthly budget, and you can create automated policies to shut down non-critical purchases when budgets are exhausted. Azure Cost Management works exactly like this: it ingests usage and billing data from Azure Resource Manager, applies tags and policies, and provides tools to analyze, forecast, and control spending. Just as a budget officer can drill into a department's expenses by vendor or project, you can filter costs by resource, location, or meter category. And just as the budget officer can set spending limits, you can create budgets and alerts to avoid bill shock. The key is that all this data comes from the same underlying usage logs, so there is a single source of truth—like a unified ledger.
What is Azure Cost Management and Why It Exists
Azure Cost Management is a suite of tools within the Azure portal that helps you plan, analyze, and optimize your cloud spending. It is built on top of the Azure billing and usage data pipeline, which records every resource consumption event at the meter level. The primary purpose is to provide visibility into where your money is going, enable forecasting, and enforce spending limits through budgets and alerts. For the AZ-104 exam, you must understand how to navigate the Cost Management + Billing blade, configure budgets, set up action groups for alerts, and use tags for cost allocation.
How It Works Internally
Azure Cost Management pulls data from the Microsoft Azure Consumption and Billing APIs. Every resource creation, deletion, or usage event generates a usage record that includes:
Resource ID
Meter ID (e.g., compute hours, storage GB)
Quantity consumed
Effective price
Subscription and resource group
Tags (if applied)
These records are aggregated into cost data that appears in the Cost Analysis view. The data is refreshed every 24 hours, but recent usage (within the last few hours) may appear with a delay. Cost Management uses a concept called 'cost allocation' to distribute shared costs (e.g., support, reserved instance discounts) across subscriptions.
Key Components, Values, Defaults, and Timers
Cost Analysis: The main dashboard for visualizing costs. You can group by subscription, resource group, resource type, location, or tag. Default view shows accumulated costs for the current month.
Budgets: You can create budgets at subscription or resource group scope. Budgets have a threshold (e.g., $1000) and can trigger alerts at percentages (e.g., 50%, 80%, 90%, 100%). Alerts can send email or invoke an action group (e.g., run a runbook to shut down VMs). Budgets are evaluated every 24 hours.
Action Groups: Define how alerts are delivered (email, SMS, webhook, ITSM). For cost alerts, you typically use an action group with an email address.
Tags: Tags are key-value pairs that you apply to resources. They are inherited from resource groups but not automatically propagated. Cost Management can group costs by tag values.
Cost Export: You can export cost data to a storage account (blob or ADLS) on a daily, weekly, or monthly schedule. The export uses the 'Cost and Usage Details' dataset.
Azure Reservations and Savings Plans: These provide discounts for committed usage. Cost Management shows effective savings and amortized costs.
Configuration and Verification Commands
To create a budget using Azure CLI:
az consumption budget create \
--budget-name "MonthlyBudget" \
--amount 1000 \
--time-grain monthly \
--start-date 2025-01-01 \
--end-date 2025-12-31 \
--category cost \
--scope "/subscriptions/12345678-1234-1234-1234-123456789012" \
--notifications '{"thresholdType":"Actual","threshold":80.0,"operator":"GreaterThan","enabled":true,"contactEmails":["admin@contoso.com"]}'To view cost data via PowerShell:
Get-AzConsumptionUsageDetail -BillingPeriodName "202502" -IncludeMeterDetailsTo export cost data:
az costmanagement export create \
--name "DailyExport" \
--scope "/subscriptions/12345678-1234-1234-1234-123456789012" \
--storage-account-id "/subscriptions/.../storageAccounts/mystorageacct" \
--storage-container "costexports" \
--recurrence "Daily" \
--recurrence-period from="2025-01-01" to="2025-12-31" \
--definition '{"type":"ActualCost","timeframe":"MonthToDate","dataSet":{"granularity":"Daily","grouping":[{"type":"TagKey","name":"Department"}]}}'Interaction with Related Technologies
Cost Management integrates with Azure Policy to enforce tagging (e.g., require a 'CostCenter' tag). It also works with Azure Advisor to provide cost optimization recommendations (e.g., right-sizing VMs, purchasing reserved instances). The data can be exported to Power BI for advanced analytics. For the exam, know that budgets can trigger automation via Azure Automation runbooks or Logic Apps through action groups.
Common Exam Scenarios
Tag inheritance: Tags are not automatically inherited from resource groups. You must apply them explicitly or use Azure Policy to enforce inheritance.
Budget scope: Budgets can be set at subscription or resource group level, not at management group level directly (though you can create policies at management group).
Cost export format: The exported data is in CSV or JSON format. The dataset includes both actual cost and amortized cost (for reservations).
Alert thresholds: You can set multiple thresholds per budget (e.g., 50%, 80%, 90%, 100%). The alert triggers when the actual cost exceeds the threshold.
Trap Patterns on the Exam
Confusing cost analysis with budget alerts: Cost analysis shows historical data; budgets are proactive thresholds.
Assuming tags are inherited: This is a common wrong answer. Tags must be applied to each resource or inherited via policy.
Mixing up consumption and billing periods: The exam may ask about 'BillingPeriodName' vs 'UsagePeriod'. Know that billing periods are monthly, while usage data can be daily.
Forgetting that cost exports require a storage account: The exam may present a scenario where a storage account doesn't exist; the correct answer is to create one first.
Access Cost Management + Billing
In the Azure portal, navigate to 'Cost Management + Billing'. If you have multiple billing accounts, select the correct one (e.g., Microsoft Customer Agreement or Enterprise Agreement). For exam purposes, you typically work with a single subscription. The blade shows an overview of your current month's costs, forecast, and any active budgets.
Analyze Current Costs with Cost Analysis
Click 'Cost analysis' to open the interactive chart. By default, it shows accumulated costs for the current month. You can change the view to daily, group by resource group, or filter by tag. The exam tests your ability to interpret these views, e.g., 'Which resource type incurred the most cost this month?' Use the 'Group by' dropdown to select 'Meter category' to see compute vs storage costs.
Create a Budget with Alerts
Go to 'Budgets' and click '+ Add'. Set the scope (subscription or resource group), name, amount, and time grain (monthly, quarterly, yearly). Under 'Alert conditions', define thresholds (e.g., 80% of budget) and associate an action group. The action group can send an email or trigger an automation runbook. Budgets are evaluated daily, so alerts may have up to 24-hour latency.
Configure Cost Allocation Using Tags
To track costs by department, ensure resources have a 'Department' tag. In Cost Analysis, group by 'Tag' and select the tag key. You can also use 'Cost allocation rules' to split shared costs (e.g., a common SQL server) across multiple departments by percentage. This is an advanced feature but may appear on the exam as a way to distribute costs fairly.
Export Cost Data for External Analysis
Go to 'Exports' and click '+ Add'. Specify the export name, scope, storage account, container, and recurrence (daily, weekly, monthly). Choose the dataset type: 'Actual cost' or 'Amortized cost'. The export creates a CSV file with granular usage data. You can then import this into Power BI or Excel for custom reporting.
Enterprise Scenario 1: Multi-Department Cost Tracking
A large enterprise with 10 departments each has its own Azure subscription. They need to track spending by department and ensure no department exceeds its monthly budget of $50,000. The cloud administrator creates a management group containing all subscriptions. At each subscription scope, they apply a tag 'Department' with the respective value (e.g., 'Engineering', 'Marketing'). They then create budgets at subscription level with alerts at 80% and 100% sent to the department head's email. They also create a cost export to a central storage account for monthly finance reports. A common issue is that new resources are created without tags, causing 'untagged' costs. To solve this, they use Azure Policy to enforce tagging: if a resource lacks the 'Department' tag, the policy denies creation or applies a default tag. Performance is not an issue as cost data is aggregated once daily.
Enterprise Scenario 2: Reserved Instance Cost Optimization
A company runs 100 D2s v3 VMs 24/7. They purchase a one-year reserved instance for 80 VMs to save 40% compared to pay-as-you-go. Using Cost Management, they can see the effective savings in the 'Amortized cost' view. They also set up a budget alert to notify if the amortized cost exceeds $10,000. However, they notice that the 'Actual cost' view shows the full upfront payment for the reservation in the first month, which skews monthly budgets. They switch to 'Amortized cost' for budget alerts to smooth the cost. A misconfiguration could occur if they forget to apply the reservation to the correct subscription scope, causing the discount to apply to the wrong resources.
Enterprise Scenario 3: Cost Anomaly Detection
A SaaS startup uses Azure Cost Management to monitor daily spending. One day, costs spike 300% due to a developer accidentally deploying a GPU cluster for a test that was left running. The administrator has an action group configured to send an SMS when the daily cost exceeds $500. They receive the alert and immediately shut down the resources. Without this alert, the cost could have escalated to thousands of dollars. The key lesson is to set multiple budget thresholds (e.g., 50%, 80%, 100%) and use action groups that can trigger automation (e.g., runbook to stop VMs) at the 100% threshold.
What AZ-104 Tests on This Topic
The exam objective '5.3 Manage costs by using Azure Cost Management and Billing' includes:
Configure cost analysis (group by, filter, forecast)
Create and manage budgets and alerts
Use tags for cost allocation
Export cost data
Interpret cost data (actual vs amortized)
Common Wrong Answers and Why Candidates Choose Them
'Tags are automatically inherited from resource groups' – Candidates assume that applying a tag to a resource group automatically applies it to all resources inside. Reality: Tags are NOT inherited. You must apply tags to each resource or use Azure Policy to enforce inheritance.
'Budgets can be set at management group scope' – The exam may present a scenario where you need to set a budget for multiple subscriptions. Candidates might think you can set a budget at the management group level. Reality: Budgets can only be set at subscription or resource group scope. To cover multiple subscriptions, you must create separate budgets or use a policy at management group.
'Cost alerts are triggered immediately when cost exceeds the threshold' – Candidates may think alerts are real-time. Reality: Budgets are evaluated daily, so alerts can have up to 24-hour latency.
'Actual cost and amortized cost are the same' – Candidates may confuse these. Reality: Actual cost shows the billed amount (including upfront reservation payments), while amortized cost spreads the reservation cost over the term. The exam may ask which view to use for monthly budget tracking.
Specific Numbers and Terms That Appear on the Exam
Budget thresholds: 50%, 80%, 90%, 100% (these are default, you can customize)
Time grains: monthly (default), quarterly, yearly
Cost export recurrence: daily, weekly, monthly
Dataset types: ActualCost, AmortizedCost
Action group channels: email, SMS, webhook, ITSM
Edge Cases and Exceptions
Free subscriptions: You cannot create budgets for free subscriptions because they have no payment method.
Cost export with reservations: If you export actual cost, the reservation purchase shows as a large expense on the purchase date. Use amortized cost for accurate monthly tracking.
Tag inheritance via policy: You can create a policy that adds or inherits tags from the resource group, but this is not automatic.
How to Eliminate Wrong Answers
If a question asks about setting a budget for multiple subscriptions, eliminate answers that suggest management group scope.
If a question asks about real-time cost alerts, eliminate answers that claim immediate triggering; remember the 24-hour evaluation cycle.
If a question involves cost tracking by department, look for answers that mention tagging and cost allocation rules.
Cost Management data is refreshed daily; budget alerts have up to 24-hour latency.
Tags are not inherited from resource groups; use Azure Policy to enforce tagging.
Budgets can only be created at subscription or resource group scope, not management group.
Cost exports require an existing storage account; choose ActualCost or AmortizedCost dataset.
Action groups can trigger email, SMS, webhook, or ITSM; use them for budget alerts.
Amortized cost spreads reservation costs; use it for accurate monthly budget tracking.
Azure Policy can enforce tag inheritance from resource groups to resources.
Cost analysis can group by subscription, resource group, resource type, location, or tag.
These come up on the exam all the time. Here's how to tell them apart.
Actual Cost
Shows the billed amount as it appears on the invoice.
Includes upfront payments for reservations as a lump sum.
Useful for cash flow analysis and invoice reconciliation.
May cause budget spikes in the month of reservation purchase.
Default view in Cost Analysis.
Amortized Cost
Spreads the cost of reservations over the term (e.g., 1 year).
Provides a smoother monthly cost for budgeting.
Useful for tracking ongoing spending trends.
Does not reflect actual cash outflow.
Must be selected explicitly in Cost Analysis or exports.
Mistake
Tags on a resource group automatically apply to all resources within.
Correct
Tags are not inherited. You must explicitly apply tags to each resource or use Azure Policy to enforce tag inheritance from the resource group.
Mistake
Budgets can be created at management group scope.
Correct
Budgets can only be created at subscription or resource group scope. To manage costs across multiple subscriptions, create separate budgets for each subscription.
Mistake
Cost alerts are triggered in real-time when spending exceeds the threshold.
Correct
Budgets are evaluated once every 24 hours, so alerts may have up to 24-hour latency. They are not real-time.
Mistake
Actual cost and amortized cost are the same for reserved instances.
Correct
Actual cost shows the upfront payment for reservations, causing a spike. Amortized cost spreads the cost over the reservation term, providing a smoother monthly view.
Mistake
You can export cost data without specifying a storage account.
Correct
Cost exports require an existing Azure storage account to store the exported CSV/JSON files. You must create one if it doesn't exist.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Go to Cost Management + Billing > Budgets > + Add. Set the scope (subscription or resource group), name, amount, and time grain (monthly). Define alert conditions with thresholds (e.g., 80%) and associate an action group. The budget is evaluated daily.
No, budgets can only be set at subscription or resource group scope. To cover multiple subscriptions, create a budget for each subscription individually.
Actual cost shows the billed amount including upfront reservation payments. Amortized cost spreads reservation costs over the term, providing a smoother monthly view. Use amortized cost for budgeting.
Apply a tag (e.g., 'Department') to each resource. In Cost Analysis, group by 'Tag' and select the tag key. You can also use cost allocation rules to split shared costs.
Go to Cost Management > Exports > + Add. Specify the scope, storage account, container, recurrence, and dataset type (ActualCost or AmortizedCost). The export creates CSV files daily, weekly, or monthly.
Budget alerts are evaluated daily, so there is up to 24-hour latency. Also, ensure the action group is correctly configured and the threshold is set appropriately.
Yes, you can associate an action group that triggers an Azure Automation runbook, Logic App, or webhook to shut down resources or send notifications.
You've just covered Cost Management and Billing Analysis — now see how well it sticks with free AZ-104 practice questions. Full explanations included, no account needed.
Done with this chapter?