DEV Community

Cloud9 Infosystems
Cloud9 Infosystems

Posted on

Azure Cost Management Cheat Sheet: Commands, Tools & Strategies Every DevOps Engineer Should Know

As DevOps engineers, we're great at building scalable infrastructure. But optimizing cost often falls through the cracks until finance sends an angry email.

Here's my practical cheat sheet for managing Azure costs — commands, tools, and strategies that work in production.

Quick Audit: Find Waste in 5 Minutes

Find idle VMs (Azure CLI):

List VMs with less than 5% average CPU (last 7 days)
az monitor metrics list \
  --resource <vm-resource-id> \
  --metric "Percentage CPU" \
  --interval PT1H \
  --aggregation Average \
  --start-time $(date -d '7 days ago' +%Y-%m-%dT%H:%M:%SZ)
Enter fullscreen mode Exit fullscreen mode

Find unattached disks:

List all unattached managed disks (you're paying for these!)
az disk list --query "[?managedBy==null].{Name:name, Size:diskSizeGb, SKU:sku.name, RG:resourceGroup}" -o table
Enter fullscreen mode Exit fullscreen mode

Find unused public IPs:

az network public-ip list --query "[?ipConfiguration==null].{Name:name, RG:resourceGroup}" -o table
Enter fullscreen mode Exit fullscreen mode

Top Cost-Saving Strategies (Ranked by Impact)

Strategy Savings Effort Time to ROI
Right-size VMs 30-50% Medium 1-2 weeks
Reserved Instances 30-72% Low Immediate
Azure Hybrid Benefit Up to 85% Low Immediate
Auto-shutdown dev/test 65% on those VMs Low 1 day
Spot VMs for batch Up to 90% Medium 1-2 weeks
Storage tiering 50-90% on storage Low 1 week

Automate Cost Governance

Budget alerts (ARM template snippet):

{
  "type": "Microsoft.Consumption/budgets",
  "name": "monthly-team-budget",
  "properties": {
    "category": "Cost",
    "amount": 500000,
    "timeGrain": "Monthly",
    "notifications": {
      "Over75Percent": {
        "enabled": true,
        "operator": "GreaterThan",
        "threshold": 75,
        "contactEmails": ["team-lead@company.com"]
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Auto-shutdown schedule (Azure CLI):

az vm auto-shutdown -g MyResourceGroup -n MyDevVM --time 1900 --timezone "India Standard Time"
Enter fullscreen mode Exit fullscreen mode

Tools Worth Knowing

  1. Azure Cost Management + Billing — Native cost analysis and forecasting
  2. Azure Advisor — Right-sizing and RI recommendations
  3. Azure Resource Graph — Query resources at scale
  4. Power BI Cost Dashboard — Custom team-level visibility
  5. Terraform/Bicep — Infrastructure-as-Code with cost-aware defaults

When to Get External Help

If your Azure bill is consistently above ₹10L/month and you don't have a dedicated FinOps practice, it's worth engaging specialists. I've seen teams at Cloud 9 Infosystems reduce Azure costs by 40%+ for enterprise clients using a combination of the strategies above plus reserved instance planning and license optimization that's hard to do without deep Microsoft partnership expertise.

Key Metrics to Track Monthly

  • Cloud Unit Economics: Cost per transaction / per user / per GB
  • Coverage ratio: % of compute covered by RIs or Savings Plans
  • Waste ratio: Idle resources / total resources
  • Anomaly alerts: Unexpected spend spikes

If this was useful, follow me for more Azure infrastructure content. Next week: building a cost anomaly detection system with Azure Functions + Logic Apps.


Top comments (0)