← Projects
Active Work

Infrastructure Cost Anomaly Detector

View on GitHub ↗
PythonAzure Cost Management APIpandasscikit-learnAzure Logic AppsPower BI

About this project

Python-based Azure cost anomaly detection system that monitors daily spend patterns, identifies statistical outliers, and alerts on unexpected cost spikes before they compound across billing cycles.

Background

Cloud cost surprises are avoidable with the right instrumentation, but the Azure Cost Management portal is built for analysis after the fact, not for operational alerting. By the time an unexpected cost spike shows up in the monthly bill review, it's too late to do much about it. The anomaly detector shifts that window significantly earlier by monitoring daily spend patterns and alerting within 24 hours of a statistical deviation.

The detection approach is intentionally simple: Z-score and IQR-based outlier detection on rolling 30-day windows per resource group and service. More sophisticated models exist but they require more data and more tuning, and the simple models catch the scenarios that actually matter — a forgotten test environment left running, a misconfigured autoscale policy, an accidental deployment of an expensive SKU. The alert includes enough context (resource group, service type, deviation magnitude) to investigate without opening the portal.

Tag-based cost allocation enforcement was added as a complementary feature: any resource without required tags is flagged separately. Untagged resources are both a governance failure and a cost attribution failure — you can't allocate cost to a business unit if the resource isn't tagged correctly. Power BI provides the trend visualisation and forecast-vs-actuals view for finance and leadership stakeholders who need a different level of granularity than the operational alerts.

Highlights

  • Daily cost ingestion from Azure Cost Management API by resource group and service
  • Z-score and IQR-based anomaly detection on rolling 30-day windows
  • Alert routing via Logic Apps to Teams and email with cost attribution context
  • Power BI dashboard with trend visualisation and forecast vs. actuals
  • Tag-based cost allocation enforcement — flags untagged resources automatically
← All projects GitHub ↗
← Vulnerability Management Dashboard AI Policy & Governance Framework →