VOOZH about

URL: https://dev.to/datanestdigital/azure-cost-guardian-toolkit-a-comprehensive-guide-2026-4oba

⇱ Azure Cost Guardian Toolkit - DEV Community


Azure Cost Guardian Toolkit

By Datanest Digital | Version 1.0.0 | $59


Overview

The Azure Cost Guardian Toolkit is a comprehensive, production-ready collection of scripts,
queries, policies, notebooks, and templates designed to give engineering and FinOps teams
complete visibility and control over Azure cloud spend.

Whether you are a platform engineer implementing cost guardrails, a FinOps practitioner
building chargeback models, or a team lead trying to eliminate waste, this toolkit provides
the building blocks to operationalize cloud cost management from day one.

What's Included

Component Description
Cost Management Queries 50+ Python functions wrapping Azure Cost Management APIs for programmatic spend analysis
Budget Alert Policies Ready-to-deploy budget alert configurations at subscription, resource group, and tag levels
Tagging Enforcement Policies Azure Policy definitions to enforce consistent resource tagging across your organization
Cost Anomaly Detection Notebook Databricks notebook for daily cost anomaly detection with configurable alerting thresholds
Reserved Instance Calculator Databricks notebook for RI sizing analysis and break-even calculations
Idle Resource Detector Script to find and report unused disks, unattached NICs, stopped VMs, and other waste
Storage Lifecycle Manager Automated storage tier management (hot -> cool -> archive) based on access patterns
Advisor Automation Script to fetch, filter, and act on Azure Advisor cost recommendations
Terraform Modules Infrastructure-as-code for budget alerts, action groups, and cost management resources
FinOps Review Templates Monthly executive review and chargeback/showback report templates
FinOps Playbook Comprehensive guide covering crawl-walk-run FinOps adoption

Prerequisites

  • Python 3.9+
  • Azure SDK for Python (azure-mgmt-costmanagement, azure-mgmt-consumption, azure-identity)
  • Terraform 1.5+ (for infrastructure modules)
  • Databricks Runtime 13.x+ (for notebooks)
  • Azure subscription with Cost Management Reader (minimum) role

Quick Start

1. Install Dependencies

pip install azure-identity azure-mgmt-costmanagement azure-mgmt-consumption \
 azure-mgmt-resource azure-mgmt-compute azure-mgmt-network azure-mgmt-storage \
 azure-mgmt-advisor azure-mgmt-monitor pandas numpy scipy requests

2. Authenticate

from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()

3. Run Your First Query

from queries.cost_management_queries import get_monthly_cost_by_service

results = get_monthly_cost_by_service(
 credential=credential,
 subscription_id="your-subscription-id",
 months_back=3
)

4. Deploy Budget Alerts (Terraform)

cd terraform/cost-management
terraform init
terraform plan -var="subscription_id=your-sub-id" -var="monthly_budget=5000"
terraform apply

5. Detect Idle Resources

python scripts/idle_resource_detector.py \
 --subscription-id your-sub-id \
 --output-format json \
 --output-path ./reports/idle_resources.json

Project Structure

08-azure-cost-guardian/
├── README.md
├── manifest.json
├── queries/
│ └── cost_management_queries.py # 50+ API query templates
├── policies/
│ ├── budget_alerts.json # Budget alert configurations
│ └── tagging_enforcement.json # Azure Policy for tagging
├── notebooks/
│ ├── cost_anomaly_detection.py # Daily anomaly detection
│ └── reserved_instance_calculator.py # RI sizing analysis
├── scripts/
│ ├── idle_resource_detector.py # Unused resource detection
│ ├── storage_lifecycle_manager.py # Storage tier management
│ └── advisor_automation.py # Advisor recommendations
├── templates/
│ ├── monthly_finops_review.md # Executive review template
│ └── chargeback_report.md # Chargeback/showback template
├── terraform/
│ └── cost-management/
│ ├── main.tf # Budget alerts & action groups
│ └── variables.tf # Terraform variables
└── guides/
 └── finops_playbook.md # Comprehensive FinOps guide

Configuration

All scripts support configuration via environment variables:

Variable Description Default
AZURE_SUBSCRIPTION_ID Target Azure subscription Required
AZURE_TENANT_ID Azure AD tenant ID From credential
COST_ALERT_WEBHOOK_URL Webhook URL for cost alerts None
COST_ANOMALY_THRESHOLD Standard deviations for anomaly detection 2.5
IDLE_RESOURCE_AGE_DAYS Days before a stopped resource is flagged idle 7

Related Products


This is 1 of 20 resources in the Datanest Platform Pro toolkit. Get the complete [Azure Cost Guardian Toolkit] with all files, templates, and documentation for $59.

Get the Full Kit →

Or grab the entire Datanest Platform Pro bundle (20 products) for $199 — save 30%.

Get the Complete Bundle →


Related Articles