Azure cost management: start in Microsoft Cost Management
If you searched for Azure cost management, you may want Microsoft’s own tool. Microsoft Cost Management is a suite of FinOps tools to analyze, monitor and optimize your Microsoft Cloud costs. In the Azure portal, it’s on every subscription, resource group and management group.
What you can do there:
- explore your costs in Cost analysis;
- set budgets that alert you when cost passes an amount or a forecast;
- get anomaly alerts when a subscription’s daily usage spikes or dips;
- export cost details to your storage account on a schedule;
- read Azure Advisor’s cost recommendations.
Tag your resources first. Resource tags are the only way to add your own context, such as an app, environment or owner, to cost details. Cost allocation tags explains how to set them.
This page isn’t Microsoft’s tool, and it doesn’t replace it. It’s a guide to the fixes that reduce what those reports show.
Azure cost optimization, one cost line at a time
Azure cost optimization works one cost line at a time. Each line has its own driver and its own first fix.
| Cost line | What you pay for | First fix | Who helps |
|---|---|---|---|
The time a VM stays allocated, busy or idle. | Deallocate idle VMs and resize oversized ones. | Azure Advisor flags them. | |
The size you provision, whatever data it holds. | Delete disks no VM uses, then size the rest to their data. | Advisor flags unattached disks. Amoeba rightsizes data disks. | |
The node VMs, which grow with what your pods request. | Fit requests to real use, then let spare nodes go. | AKS cost analysis shows it. Coral rebalances the cluster. | |
Data that leaves a region. | Keep services that talk to each other in one region. | Your network design. | |
A one- or three-year commitment. | Buy last, sized to what the fixes leave. | Advisor recommends a size. |
Virtual machines: deallocate idle ones, resize the rest
A VM’s compute charge follows its power state, not how busy it is. Azure charges a running VM for instance usage. It also charges a VM that’s Stopped (allocated), the state a shutdown from inside the guest OS leaves.
Only a deallocated VM has released its hardware and stopped the instance charge. Its disks and networking still cost. In the Azure CLI, az vm stop keeps the compute resources, and az vm deallocate releases them.
For VMs that run all day with little load, start with Azure Advisor. Microsoft calls its cost recommendations the first stop for existing resources. On its Cost tab, Advisor flags VMs and scale sets with low usage, and recommends rightsizing or shutting them down.
Then check how you pay for the VMs you keep:
- Spot VMs use spare Azure capacity at up to 90% off pay-as-you-go prices. Azure evicts them when it needs the capacity back, so keep them for dev, test and batch work.
- Azure Hybrid Benefit lets you use Windows Server and SQL Server licenses you already own, or Red Hat and SUSE Linux subscriptions, on Azure.
- Reservations and savings plans come last, once your VM sizes have settled.
Managed disks: you pay for the size, not the data
An Azure managed disk is charged for what you provision, not for the data on it. How depends on the disk type:
- Premium SSD, Standard SSD and Standard HDD are charged by a performance tier, which the size you pick sets by default. Grow a Standard SSD or Standard HDD into the next tier, and you pay for that tier.
- Premium SSD v2 and Ultra Disk are charged per GiB, plus the performance you provision.
- Every Premium SSD v2 includes 3,000 IOPS and 125 MB/s free of charge.
A managed disk can grow, but it can’t shrink. Shrinking an existing disk “isn’t supported and might result in data loss,” Microsoft Learn says. So space bought for a peak stays paid for after the data has gone.
Start with these checks:
- Find disks no VM uses. Advisor lists disks that aren’t attached to a VM, and Microsoft advises a snapshot first, because deleting a disk is irreversible. How to find unattached disks in Azure shows the queries.
- Compare used with provisioned space on each data disk. Azure VM disk usage shows how.
- Check the type. Premium SSD v2 vs Premium SSD compares the two Premium SSD types.
Azure disk cost optimization walks through every step, and the Azure disk pricing calculator prices one disk at list price. How to reduce Azure disk size covers the copy to a smaller disk.
AKS: requests decide how many nodes you pay for
An AKS cluster’s nodes are Azure VMs, grouped in node pools. You pay for them as compute, so the number and size of the nodes drive the cost.
That number follows what your pods request. The Cluster Autoscaler adds nodes when pods can’t be scheduled for lack of resources, and removes nodes with no running pods. AKS node auto provisioning (NAP) picks VM sizes from what pending pods request.
So a request set well above real use holds capacity that nothing uses. Microsoft’s AKS guidance says requests higher than actual usage can lead to overprovisioned workloads.
The fix, in order:
- Bring each container’s requests close to what it uses. The Vertical Pod Autoscaler can recommend values from past usage. Kubernetes pod right sizing shows how.
- Let the spare nodes go. Once pods fit on fewer nodes, the autoscaler can remove the empty ones. Cluster Autoscaler not scaling down covers what keeps a node in place.
- Stop dev and test clusters when they don’t need to run. Cluster stop shuts down every node pool, and the cluster keeps its state for when you start it again.
- Run work that can take an interruption on Spot node pools.
To see where the money goes inside a cluster, turn on the AKS cost analysis add-on. It splits cluster cost by Kubernetes constructs, beside Azure’s compute, network and storage categories. AKS cost analysis explains what it shows.
Kubernetes cost optimization on AKS and EKS is the full guide. The EKS and AKS pricing calculator prices a node pool.
Data transfer: keep traffic inside one region
Azure prices data transfer as bandwidth: data moving in and out of its data centers, and between them. Its bandwidth pricing page sets these rules:
- Data coming in is free.
- Data between Azure services in the same region isn’t charged.
- Data out to the internet is free for the first 100 GB a month, then charged per GB, in tiers.
- Data between two regions is charged on the way out, and free on the way in.
Bandwidth pricing leaves out the Content Delivery Network, ExpressRoute and peering, which have their own prices.
Internet egress has two prices. One routes it over Microsoft’s premium global network, and the other over a transit ISP network, through routing preference. The transit ISP route is priced less on every paid tier.
So keep services that talk to each other in one region, and watch what leaves it. Microsoft’s AKS guidance gives the same warning: a cheaper region for compute can bring latency and data transfer costs. Egress cost explains the terms.
Reservations and savings plans: commit last
Azure offers two ways to commit, each for one or three years.
| Azure reservation | Azure savings plan for compute | |
|---|---|---|
What you commit to | A specific resource, size and region | A fixed hourly spend, across eligible services and regions |
Discount | Up to 72% against pay-as-you-go prices | Up to 65% against pay-as-you-go prices |
Best for | Stable, predictable usage | Usage that changes, or spreads across services and regions |
Each hour, a savings plan’s discount covers eligible usage up to the commitment, and anything beyond is charged at pay-as-you-go rates. Commitment an hour doesn’t use expires. It doesn’t roll over.
Savings plans can’t be canceled or refunded, and the one for compute doesn’t cover software, networking or storage. When a reservation expires, its resources keep running, but at on-demand rates.
So commit after the fixes above, not before. Azure Advisor bases its savings plan recommendation on your eligible on-demand usage. Bought first, a plan is sized to usage you’re about to remove.
The glossary covers reserved instances and savings plans in more depth.
