The Azure Cost Optimization Scanner is a Python script that detects unused or idle Azure resources (stopped VMs, unattached disks, unused IPs, orphaned NICs) and estimates potential monthly savings. It generates a simple, human‑readable report to highlight cost optimization opportunities.
- Finds stopped/idle VMs that still incur storage costs.
- Detects unattached disks and estimates their monthly cost.
- Identifies unassociated public IPs that add unnecessary charges.
- Lists unused NICs (no direct cost, but clutter).
- Generates a summary report with estimated monthly savings.
Make sure you have the following installed:
- Python 3.8+
- Azure CLI
- Azure SDKs for Python:
pip install azure-identity azure-mgmt-compute azure-mgmt-network azure-mgmt-resourcegraph azure-mgmt-costmanagementor
#after cloning the repo
pip install -r requirements.txtaz login- Copy the Subscription ID you want to use.
# Replace with your Azure Subscription ID
subscription_id = "YOUR_SUBSCRIPTION_ID"python AZ_SCRIPT.PY