DEV Community

Cover image for Solved: The Azure cost optimizations that actually mattered based on real tenant reviews
Darian Vance
Darian Vance

Posted on • Originally published at wp.me

Solved: The Azure cost optimizations that actually mattered based on real tenant reviews

🚀 Executive Summary

TL;DR: Azure billing surprises often result from easy resource provisioning and difficult deprovisioning, leading to costly ‘zombie’ resources and over-provisioning. This guide outlines a three-tiered approach to cost optimization, moving from immediate waste reduction to proactive guardrails and deep architectural reviews for sustainable savings.

🎯 Key Takeaways

  • Orphaned managed disks are a significant cost culprit; identify them using Azure Resource Graph Explorer with a Kusto query for ‘Unattached’ disks.
  • Implement automated budget enforcement by configuring Azure Budgets to trigger Azure Automation runbooks or Logic Apps, which can automatically stop VMs when budget thresholds are reached.
  • Achieve transformational savings through architectural rightsizing, such as migrating suitable workloads to Azure Container Apps (scaling to zero), optimizing database RUs, and leveraging Spot instances for non-critical compute.

Tired of Azure’s billing surprises? This guide cuts through the noise, offering real-world, actionable cost optimization strategies that go beyond the official documentation, based on what actually works in production environments.

The Azure Cost Optimizations That Actually Mattered (A View From The Trenches)

I still remember the Monday morning email from finance. The subject line was just “Azure Bill” and my stomach dropped. A junior engineer, trying to impress everyone, had spun up a massive NV-series VM for a “quick ML model test” on a Friday afternoon and promptly forgotten about it. Over one weekend, that single forgotten resource burned through more cash than our entire staging environment’s monthly budget. That’s the thing about the cloud – its greatest strength, the infinite shelf of powerful toys, is also its most dangerous financial trap. We’ve all been there, staring at a cost analysis chart that looks like a hockey stick, wondering where it all went wrong.

Why Your Azure Bill is a Monster Under the Bed

The root of the problem isn’t malice; it’s entropy. In the rush to deliver features, we create resources. A temporary VM for a test (dev-test-vm-temp-01), a premium SSD for a database migration that never got deprovisioned, an App Service Plan scaled up for a load test and left at P3v3. Each one is a tiny, trickling faucet. Alone, they’re nothing. Together, they create a flood. The cloud makes it frictionless to provision but adds just enough friction to deprovisioning that we say, “I’ll get to it later.” Later never comes, and the bill arrives.

The Fixes: From Band-Aids to Open-Heart Surgery

Forget the generic advice from Microsoft docs. Here’s what we *actually* did at TechResolve that moved the needle. I’m breaking it down into three levels of effort and impact.

1. The Quick Fix: The “Resource Hunter” Approach

This is your emergency-response plan. You have a billing spike *right now* and you need to stop the bleeding. Your goal is to find the most expensive, unused, or “zombie” resources.

Your best friend here is Azure Cost Management + Billing. Dive into ‘Cost analysis’ and group by ‘Resource’. Don’t just look at the total cost; look for resources with no network traffic, low CPU, or things with “temp” and “test” in the name that have been running for weeks.

A classic culprit is the orphaned managed disk. When you delete a VM, Azure helpfully keeps the disk for you… and keeps charging you for it. Here’s a Kusto query you can run in Azure Resource Graph Explorer to find these money pits:

Resources
| where type =~ 'microsoft.compute/disks'
| where properties.diskState == 'Unattached'
| project name, resourceGroup, location, properties.diskSizeGB, sku.name
Enter fullscreen mode Exit fullscreen mode

Running this and deleting the results can often save you a few hundred bucks in under 10 minutes. It’s hacky, it’s reactive, but it works when you’re in a pinch.

Pro Tip: Don’t forget Azure Advisor. It’s basic, but its “Cost” recommendations are often the lowest-hanging fruit. It will point out idle public IPs, underutilized VMs, and recommend Reserved Instances. It’s a great first-pass check.

2. The Permanent Fix: Building the Guardrails

After you’ve stopped the immediate bleeding, you need to prevent it from happening again. This is about building systems and policies so that doing the right thing is easier than doing the wrong thing. This is where you graduate from firefighter to architect.

  • Mandatory Tagging: Implement an Azure Policy that prevents resource creation if it doesn’t have a ‘Creator’ or ‘CostCenter’ tag. This ends the mystery of “who spun this up?”. No more guessing games.
  • Automation with Budgets: Don’t just set a budget alert that sends an email nobody reads. Configure the Action Group on that budget to trigger an Azure Automation runbook or a Logic App. When a dev subscription hits 90% of its monthly budget, your runbook can automatically execute a “Stop-AzVM” command on all its VMs. It’s heavy-handed, but it forces a conversation.
  • Embrace Reserved Instances & Savings Plans: This is the single biggest cost-saver for predictable workloads. If you know your production database server (prod-db-01) isn’t going anywhere for the next year, put a reservation on it. You can save up to 70%. It requires some forecasting, but the payoff is massive.

3. The ‘Nuclear’ Option: The Great Rightsizing & Architectural Review

This is the hard one. It’s not about finding waste; it’s about challenging your core assumptions. This is where you find the 10x savings, but it requires engineering effort.

We had a suite of internal apps running on a dozen D4s_v3 VMs. They ran 24/7. The “Great Rightsizing” involved a full-scale review. We asked the tough questions:

  • Does this really need to be a VM? We moved half of them to Azure Container Apps, which scale to zero. The cost went from hundreds per month to tens.
  • Is this database over-provisioned? Our staging Cosmos DB was provisioned with 10,000 RUs, but a quick look at the metrics showed it never peaked above 800. We scaled it down and saved a fortune.
  • Can we leverage spot instances? For our CI/CD build agents, we switched to a VM Scale Set using Spot instances. The jobs take a little longer sometimes if an instance is preempted, but we’re paying pennies on the dollar for the compute.

This isn’t a quick fix; it’s a cultural shift. It means instrumenting your applications to understand their actual performance needs, not just what you guessed during the initial design. It’s about treating cost as a first-class, non-functional requirement, just like performance and security.

Strategy Effort Impact Best For
1. The Resource Hunter Low Medium (Immediate) Putting out fires and cleaning up obvious waste.
2. Building Guardrails Medium High (Long-term) Preventing future cost overruns and enforcing good behavior.
3. The Great Rightsizing High Massive (Transformational) Mature environments looking for deep, sustainable savings.

Ultimately, managing Azure cost isn’t a one-time project. It’s a continuous process of vigilance, automation, and honest architectural assessment. Start with the quick wins to build momentum, implement guardrails to maintain control, and never be afraid to question if the architecture you built last year is still the right one for today.


Darian Vance

👉 Read the original article on TechResolve.blog


☕ Support my work

If this article helped you, you can buy me a coffee:

👉 https://buymeacoffee.com/darianvance

Top comments (0)