Skip to main content

Azure Cost Optimizer

A powerful CLI tool that analyzes Azure resources and identifies cost optimization opportunities. Provides actionable recommendations with projected savings across compute, storage, networking, and database services.

CI Python 3.9+ License: MIT

Features

  • 30 cost checks across 5 categories (Compute, Storage, Networking, Database, General)
  • Severity classification — HIGH, MEDIUM, LOW with effort estimates
  • Beautiful terminal output — Rich tables, panels, color-coded findings
  • Export reports — JSON and CSV formats for stakeholder sharing
  • Demo mode — Try instantly without Azure credentials
  • Filtering — By severity level or resource category
  • Optimization grading — Letter grade (A-F) based on savings potential

Quick Start

Install

pip install -e .

Run Demo

azure-cost scan --demo

See All Checks

azure-cost summary

Usage

Scan with Demo Data

# Full scan with demo data
azure-cost scan --demo

# Filter by severity
azure-cost scan --demo --severity HIGH

# Filter by category
azure-cost scan --demo --category COMPUTE

# Export JSON report
azure-cost scan --demo --export-json report.json

# Export CSV report
azure-cost scan --demo --export-csv findings.csv

# Combine filters and export
azure-cost scan --demo --severity HIGH --category DATABASE --export-json critical-db.json

Available Commands

Command Description
azure-cost scan --demo Run cost analysis with demo data
azure-cost summary Show all 30 checks the tool performs
azure-cost --version Show version

What It Checks

Compute (7 checks)

Check Severity Potential Savings
Stopped but allocated VMs HIGH ~85%
Idle VMs (< 5% CPU) HIGH ~95%
Underutilized VMs (< 20% CPU) MEDIUM ~40%
Dev/test VMs without auto-shutdown MEDIUM ~65%
Reserved Instance candidates LOW ~38%
Scale sets with fixed instance count MEDIUM ~30%
Overprovisioned App Services HIGH ~60%

Storage (5 checks)

Check Severity Potential Savings
Unattached managed disks HIGH 100%
Premium disks with low IOPS MEDIUM ~65%
Old snapshots (> 90 days) MEDIUM 100%
Aging snapshots (> 30 days) LOW ~80%
Hot storage with infrequent access MEDIUM ~45%

Networking (5 checks)

Check Severity Potential Savings
Orphaned public IP addresses HIGH 100%
Load balancers with no backends HIGH 100%
Load balancers with no rules MEDIUM ~50%
Unused NAT Gateways HIGH 100%
Oversized Application Gateways MEDIUM ~35%

Database (8 checks)

Check Severity Potential Savings
Oversized SQL Databases (low DTU) HIGH ~55%
SQL storage over-provisioned LOW ~10%
Dev/test DBs on production SKUs HIGH ~80%
Idle Cosmos DB accounts HIGH ~90%
Over-provisioned Cosmos DB RUs MEDIUM ~45%
Oversized Redis Cache MEDIUM ~50%
Idle Redis Cache HIGH ~95%
Underutilized MySQL servers MEDIUM ~45%

General (5 checks)

Check Severity Potential Savings
Empty resource groups LOW —
High-cost untagged resources MEDIUM —
Untagged resources LOW —
Resources in expensive regions LOW ~20%
Long-running resources (> 1 year) LOW —

Architecture

azure_cost_optimizer/
├── cli.py              # Click CLI entry point
├── scanner.py          # Orchestrator — runs all analyzers
├── models.py           # Data models (Severity, Category, CostFinding, etc.)
├── demo.py             # Demo mode with realistic mock data
├── analyzers/
│   ├── base.py         # Abstract base analyzer
│   ├── compute.py      # VM, scale set, app service checks
│   ├── storage.py      # Disk, snapshot, storage account checks
│   ├── networking.py   # Public IP, load balancer, NAT gateway checks
│   ├── database.py     # SQL, Cosmos DB, Redis, MySQL checks
│   └── misc.py         # Resource groups, tags, regions
└── output/
    ├── console.py      # Rich terminal rendering
    └── report.py       # JSON/CSV export

Development

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest -v

# Run linter
ruff check .

# Run with demo
azure-cost scan --demo

Tech Stack

  • Python 3.9+ — Core runtime
  • Click — CLI framework
  • Rich — Terminal formatting and tables
  • pytest — Testing framework
  • ruff — Linting

License

MIT License — see LICENSE for details.

Author

Sanjay S — Senior DevOps Engineer

Metadata

Release files for azure-cost-optimizer 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azure-cost-optimizer 1.0.0
File Size Uploaded Provenance
azure_cost_optimizer-1.0.0.tar.gz 23.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for azure-cost-optimizer 1.0.0
File Interpreter ABI Platform
azure_cost_optimizer-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.9 kB

Release files / azure_cost_optimizer-1.0.0.tar.gz

Download URL azure_cost_optimizer-1.0.0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1e7ee6afebdfdaaafc508e3165fe4c02b660d8399b612320201a02fc9544644c
BLAKE2b-256 checksum
How to use checksums
9b5b3578e5d38881dc17936b6f56239eeb7dbdd868d6a26faf2d68823cef84c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / azure_cost_optimizer-1.0.0-py3-none-any.whl

Download URL azure_cost_optimizer-1.0.0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42c60a03c0e06f83a02e464ab0322fc3a4254ef629adfc74c13f93b68c00e1f1
BLAKE2b-256 checksum
How to use checksums
7a4ffee1a579da77488a03733f2a75d7f307411ddf789b75cf13684689248e1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for azure-cost-optimizer 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page