Azure Cost Optimization
Azure Cost Optimization: What to Check Before Cutting Infrastructure
Every Azure cost exercise I have seen start badly started the same way: someone opens Cost Management, sorts by spend descending, finds the biggest VM, and asks whether it can be smaller.
That is a reasonable instinct and a bad first move. Rightsizing is the slowest, most political and most reversible lever available. It needs performance data nobody has been collecting, a change window, an owner who agrees, and a rollback plan. Meanwhile there is usually fifteen to thirty percent sitting in settings that need no downtime, no approval and no argument with an application team.
So the order matters more than the technique. It also tends to expose a governance problem rather than a cost one — resources with no owner, no tag and no policy that would have prevented them, usually created by accounts holding broad standing access.
The order of operations most teams get backwards
Work the levers from cheapest-to-pull to most expensive:
- Delete what nobody uses. No downtime, no approval, no risk.
- Fix the meters you are paying twice for. Tier, retention, redundancy, log ingestion.
- Commit to what you are definitely keeping. Reservations and savings plans.
- Then rightsize. With real data, on the baseline you just cleaned up.
Doing step four first is how organizations end up buying a three-year reservation for a VM family they are about to resize, or resizing a VM that should have been deleted. Both mistakes are expensive and both are common.
Commitment-based discounts come first
If a workload is going to exist for a year, paying on-demand for it is a choice. The two mechanisms are not interchangeable, and the difference is the whole decision:
- Reserved instances commit to a specific thing — a VM series in a region, SQL vCores, Cosmos DB throughput, a storage capacity tier. Deepest discount, narrowest flexibility.
- Savings plans commit to an hourly dollar amount of compute spend instead, and apply across series and regions automatically. Shallower discount, far more forgiving when the architecture moves.
The practical rule: reserve the things you cannot imagine changing, and put a savings plan under the churn. A domain controller pair that has run on the same series for four years is a reservation. A fleet of app service plans and container workloads mid-migration is a savings plan, because a reservation you stop matching is a discount you stop receiving.
Three things that get missed around commitments:
- Scope. A reservation scoped to a single subscription stops applying the moment the workload moves. Shared scope across the billing account is the default worth defending.
- Azure Hybrid Benefit. Existing Windows Server and SQL Server licenses with Software Assurance remove the OS or SQL licensing component from the meter entirely. This is a checkbox, it stacks with reservations, and it is routinely left off on machines built by hand.
- Dev/test pricing. Subscriptions converted to dev/test offers drop the Windows and SQL licensing charge on non-production machines. Which only helps if non-production is actually in those subscriptions.
Where spend actually hides
The expensive line items are visible. The wasteful ones are small, numerous, and belong to nobody. In roughly the order they are worth hunting:
- Unattached managed disks. A deleted VM does not delete its data disks unless somebody ticked the box. They bill at full provisioned capacity forever, and premium SSD bills for the size you provisioned rather than the bytes you wrote.
- Orphaned public IPs. Every standard SKU public IP bills whether or not it is associated with anything.
- NAT gateways and load balancers with no backend. Standard load balancers and NAT gateways carry an hourly charge plus data processing, independent of whether traffic flows.
- Idle Application Gateways. One of the most expensive things it is possible to leave running by accident, especially a WAF v2 instance left over from a pilot.
- Old snapshots and unmanaged VHDs in storage. Snapshot sprawl is invisible in the resource list and shows up only as a growing storage meter.
- Non-production running nights and weekends. A dev environment that runs 168 hours a week to be used for 45 is paying nearly four times what it needs to. Auto-shutdown on dev VMs is the single highest-return hour of work on this list.
- Over-provisioned redundancy. GRS on a storage account holding transient build artifacts doubles the capacity charge for data you would rebuild rather than restore.
- Retained backups for deleted machines. Recovery Services vault items outlive their source VMs and keep billing against the retention policy.
None of this requires a conversation with an application owner, which is exactly why it should happen before the conversations start.
Log Analytics ingestion and retention
This one deserves its own section because it behaves differently from everything else on the bill: it grows on its own, without anyone deploying anything.
Log Analytics bills on gigabytes ingested and gigabytes retained. Ingestion grows whenever a new resource appears, whenever someone adds a diagnostic setting, and whenever a workload gets busier. A reasonable monitoring configuration from two years ago is frequently one of the five largest line items today, and nothing changed except the environment it was pointed at.
What to look at, in order:
- Which tables dominate.
Usageanswers this in one query. It is almost always a small number of tables —AzureDiagnostics,ContainerLogInventory, verbose application traces, or an NSG flow log firehose. - Whether anything queries them. Ingesting a table that no alert rule, workbook or investigation has ever touched is a pure cost with no benefit. This is the question that actually reduces the bill.
- Table plans. Basic and Auxiliary plans cut the ingestion charge substantially for high-volume tables that are kept for forensics rather than alerting, at the cost of query features and KQL surface. A flow log table nobody alerts on is the textbook candidate.
- Retention versus archive. Interactive retention and long-term archive are separately priced. Keeping two years interactive to satisfy a control that asks for retrievability is paying a premium for an attribute the control never requested.
- Commitment tiers. Past roughly 100 GB per day, a capacity reservation on the workspace is a straightforward discount on volume you are already sending.
- Duplicate pipelines. A data collection rule and a legacy agent configuration both collecting the same events is a real pattern, and you pay for both copies.
Worth saying plainly: the goal is not less visibility. It is not paying twice for logs nobody reads while the logs an investigation needs are the ones that aged out.
What Azure Advisor won't tell you
Advisor is genuinely useful and should be the first screen you open. It finds idle and underutilized VMs, unattached disks, reservation and savings plan candidates sized from your own usage history, and a reasonable set of SKU recommendations. Start there.
Then understand its blind spots, because they are structural rather than temporary:
- It evaluates resources, not architecture. Advisor will right-size a VM. It will not tell you the three VMs should be an App Service plan, or that the Application Gateway in front of one internal app could be an internal load balancer.
- It does not know what a resource is for. A machine at eight percent utilization is either waste or a deliberately idle standby for a failover scenario. Advisor cannot tell which, so it flags both and the recommendation gets dismissed as noise.
- Its view is scoped and its data window is short. Recommendations reflect the subscriptions you are looking at over a recent lookback period. A workload with monthly or quarterly peaks reads as overprovisioned in between.
- Licensing and commercial terms are mostly outside it. Hybrid Benefit eligibility, dev/test offers, the enterprise agreement details and your actual license position do not live in Advisor.
- Data egress and inter-zone traffic rarely surface. Cross-region replication, chatty hub-and-spoke designs and availability-zone crossings show up as network meters without an obvious owner, and no recommendation points at the design choice that created them. Private endpoints add their own line here too — one per sub-resource, and a storage account has six.
What to check
The eight steps below are the cost pass inside a posture assessment, and they are deliberately ordered so that nothing requiring an application owner's sign-off comes first.
A short list worth running this quarter, in this order:
- Every unattached managed disk, orphaned public IP, empty NAT gateway and load balancer, and idle Application Gateway across every subscription. Delete or document each one.
- Auto-shutdown schedules on every non-production VM, and whether non-production is in a dev/test subscription at all.
- Hybrid Benefit status on every Windows and SQL Server machine, measured against your actual license entitlement.
- The
Usagetable in every Log Analytics workspace: top tables by volume, whether anything queries them, and whether retention matches a written requirement. - Reservation and savings plan coverage and utilization — both numbers, since an under-utilized reservation is money already spent on nothing.
- Reservation scope, confirming nothing is locked to a subscription the workload has left.
- Storage redundancy and access tiers against what the data actually requires.
- Recovery Services vault items whose source resources no longer exist.
- Only then: rightsizing candidates, with at least one full business cycle of metrics behind each decision.
Steps one through eight need no application owner's permission and no change window. That is the argument for doing them first. By the time you reach step nine you are resizing a clean environment, with a baseline that reflects what you intend to keep running, and the conversation with the application team is about one machine instead of forty.
Get practical Azure insights
Occasional technical guidance on Azure architecture, security, governance, cost optimization and cloud operations. No drip sequences, no sales cadence.