Skip to main content

Enterprise Azure cost analysis tool with comprehensive reporting

Project description

Azure Cost Analyzer

PyPI version Python 3.7+ License: MIT GitHub Actions

Enterprise-grade Azure cost analysis tool with comprehensive reporting and day-to-day cost tracking.

Azure Cost Analyzer provides detailed insights into Azure spending patterns, identifies cost drivers at the service level, and generates professional reports for budget management and cost optimization initiatives.


Quick Start

Installation

pip install azure-cost-analyzer-cli

Basic Usage

# Analyze your Azure usage data
azure-cost-analyzer your_azure_usage.csv

# Generate all report formats
azure-cost-analyzer data.csv --format all

# Custom spike detection
azure-cost-analyzer data.csv --spike-threshold 25 --min-spike-amount 500

Key Features

Comprehensive Cost Analysis

  • Day-to-day cost tracking with percentage change calculations
  • Service-level cost drivers - identify which Azure services drive daily changes
  • Subscription analysis across multiple Azure subscriptions
  • Cost spike detection with configurable thresholds

Advanced Reporting

  • Excel Reports: Multi-sheet workbooks with detailed analysis
  • PDF Reports: 9-page professional reports with charts and insights
  • Text Reports: Structured output perfect for automation

Professional CLI

  • Enterprise-grade command-line interface
  • Flexible output options and customization
  • Quiet mode for automated processing
  • Comprehensive help and documentation

Service Driver Analysis

Unique feature that shows exactly which Azure services cause daily cost increases or decreases:

17/06/2025 - Service Impact Drivers
COST INCREASES:
  Azure OpenAI                           +$334 (+25.2%)
  Virtual Machines                       +$156 (+8.7%)
  
COST DECREASES:
  Storage Accounts                       -$45 (-12.3%)

Requirements

  • Python 3.7+
  • Azure usage CSV export from Azure Cost Management
  • Dependencies: pandas, matplotlib, openpyxl, seaborn (auto-installed)

Usage Examples

Basic Analysis

# Standard analysis with Excel and PDF output
azure-cost-analyzer azure_usage_data.csv

# Text-only output for automation
azure-cost-analyzer data.csv --format txt --quiet

Advanced Configuration

# Custom output directory and spike detection
azure-cost-analyzer data.csv \
  --output-dir ./monthly-reports \
  --spike-threshold 25 \
  --min-spike-amount 500 \
  --format all

# Enterprise-level analysis with custom filenames
azure-cost-analyzer data.csv \
  --excel-output financial_analysis.xlsx \
  --pdf-output executive_report.pdf \
  --spike-threshold 50

Automation & Scripting

# Daily automated analysis
azure-cost-analyzer daily_export.csv --format txt --quiet > daily_summary.log

# Weekly comprehensive reports
azure-cost-analyzer weekly_export.csv --format all --output-dir ./weekly-reports

Report Formats

Format Description Use Case
Excel Multi-sheet workbook with 7 detailed worksheets Detailed analysis, data manipulation
PDF 9-page professional report with charts Executive reporting, presentations
TXT Structured text with comprehensive service drivers Automation, monitoring systems

Excel Report Contents

  • Daily analysis with service drivers
  • Subscription-level tracking
  • Service costs by date ranges
  • Cost spike analysis
  • Top services ranking
  • Executive summary

PDF Report Contents

  • Executive summary with key metrics
  • Cost trend visualizations
  • Service analysis charts
  • Spike detection graphs
  • Subscription distribution

Use Cases

Enterprise Cost Management

  • Monthly executive reporting
  • Budget variance analysis
  • Cost optimization initiatives
  • Departmental chargebacks

Cost Investigation

  • Anomaly detection and investigation
  • Service-level cost driver analysis
  • Unexpected bill analysis
  • Resource optimization planning

Automation & Monitoring

  • Daily cost monitoring
  • Automated alerting systems
  • Integration with monitoring tools
  • Scheduled reporting

Financial Planning

  • Trend analysis for budgeting
  • Forecasting support data
  • Cost allocation tracking
  • ROI analysis preparation

Command Reference

Required Arguments

  • csv_file - Path to Azure usage CSV export file

Output Format Options

  • --format {excel,pdf,txt,both,all} - Report format (default: both)

Analysis Configuration

  • --spike-threshold FLOAT - Spike detection percentage threshold (default: 30)
  • --min-spike-amount FLOAT - Minimum spike amount in dollars (default: 100)

File Management

  • --output-dir DIR - Output directory for reports
  • --excel-output FILE - Custom Excel filename
  • --pdf-output FILE - Custom PDF filename
  • --txt-output FILE - Custom text filename

Display Options

  • --quiet - Minimal output for automation
  • --no-summary - Skip console analysis summary
  • --version - Show version information

Integration

Python API

from azure_cost_analyzer import AzureCostAnalyzer

analyzer = AzureCostAnalyzer('data.csv')
analyzer.load_data()
analyzer.analyze_daily_costs()
summary = analyzer.get_summary_statistics()

Automation Scripts

# Bash automation example
#!/bin/bash
azure-cost-analyzer daily_$(date +%Y%m%d).csv \
  --format txt --quiet \
  --output-dir ./reports

Documentation


Installation Methods

PyPI (Recommended)

pip install azure-cost-analyzer-cli

Development Installation

git clone https://github.com/CodeVerdict/azure-cost-reporter.git
cd azure-cost-reporter
pip install -e .

Manual Installation

git clone https://github.com/CodeVerdict/azure-cost-reporter.git
cd azure-cost-reporter
pip install -r requirements.txt
chmod +x azure_cost_analyzer.py

Sample Output

Console Summary

AZURE COST ANALYSIS SUMMARY
===============================================
Period: 2025-01-16 to 2025-06-26
Total Cost: $115,668.79
Average Daily Cost: $738.65
Maximum Daily Cost: $9,985.27
Minimum Daily Cost: $82.01
Cost Spikes Detected: 37

SUBSCRIPTION BREAKDOWN:
  • production: $64,912.34 (56.1%)
  • non-production: $48,012.45 (41.5%)
  • management: $2,744.00 (2.4%)

TOP 5 SERVICES:
  1. Azure OpenAI: $66,553.87 (57.5%)
  2. Virtual Machines: $23,445.12 (20.3%)
  3. Storage Accounts: $12,334.56 (10.7%)

Service Driver Analysis

RECENT DAILY CHANGES (Last 10 days):
  25/6/2025: $614.65 (+649.8%) 
      Top driver: Azure OpenAI (+$534)
  26/6/2025: $82.01 (-86.7%)
      Top driver: Azure OpenAI (-$532)

Contributing

We welcome contributions! Please see our contributing guidelines for details.

Development Setup

git clone https://github.com/CodeVerdict/azure-cost-reporter.git
cd azure-cost-reporter
pip install -e ".[dev]"

Running Tests

pytest
azure-cost-analyzer --version
azure-cost-analyzer --help

License

This project is licensed under the MIT License - see the LICENSE file for details.


Enterprise Support

Qanooni Internal Tool - For enterprise support, feature requests, or custom implementations, contact the Qanooni development team.

Version Information

  • Current Version: 2.0.0
  • Python Support: 3.7+
  • Platform: Cross-platform (Windows, macOS, Linux)
  • Status: Production Ready

Recent Updates

  • v2.0.0: Complete rewrite with single-file architecture
  • Enhanced CLI: Professional command-line interface
  • Service Drivers: Detailed service-level cost analysis
  • Multiple Formats: Excel, PDF, and TXT reporting
  • PyPI Distribution: Available via pip install
  • GitHub Actions: Automated testing and deployment

Documentation | Quick Start | Download | Issues

Made with care by the Qanooni Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure_cost_analyzer_cli-2.0.0.tar.gz (40.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

azure_cost_analyzer_cli-2.0.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file azure_cost_analyzer_cli-2.0.0.tar.gz.

File metadata

  • Download URL: azure_cost_analyzer_cli-2.0.0.tar.gz
  • Upload date:
  • Size: 40.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for azure_cost_analyzer_cli-2.0.0.tar.gz
Algorithm Hash digest
SHA256 94f6e5861b49c9ee49b1b1ead1392225a17b0e314ea5435572b02fee38696dc8
MD5 26f63527788a6427afcfa1d985ec98b8
BLAKE2b-256 084b784bbb20fae733c0ac915139ebceeaab7c88032b63655b4653e7df336fff

See more details on using hashes here.

File details

Details for the file azure_cost_analyzer_cli-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_cost_analyzer_cli-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07b4df99359f8b40a69390b075da4f04de0769e54a3cacfc4e7781269b2baf9b
MD5 78d1e85e12172cae529e898712cafc71
BLAKE2b-256 337589d96c6dd07ea06467dceda653343217248df448f6a3f0ddc950afc7235c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page