Azure DevSecFinOps: Automating Governance at Scale
How we embedded Checkov security scanning and Infracost financial guardrails directly into GitHub Actions to block unapproved $28,000 cloud bills before merge.
“FinOps isn’t reviewing an Azure invoice at the end of the month and crying into your coffee. FinOps is blocking a pull request before a developer accidentally merges a $28,000 GPU cluster deployment into production.”
In early 2024, in my current role as Associate Director, Cloud Architecture & AI, I led a governance transformation for an enterprise client scaling out their Azure platform.
The client had 15 autonomous application development teams pushing Terraform infrastructure code daily across 30 subscriptions.
Agility was high. Governance was zero.
Security teams complained about unencrypted storage accounts, while the Finance Director complained about unbudgeted monthly cloud spend spikes.
The Ticket Gate Nightmare
The company’s initial attempt to solve governance was traditional corporate control: mandatory manual ticket reviews.
Before any developer could merge a Terraform pull request, they had to open two tickets:
- A ticket to the Security team to review the HCL code for compliance errors.
- A ticket to the Finance team to estimate monthly cost impact.
The result was operational paralysis.
Developers waited an average of 5 business days for security review and 3 business days for finance approval. Deployment velocity dropped by 80%.
Frustrated by the ticket bottleneck, developers began quietly bypassing the CI/CD pipeline altogether—using leftover elevated Azure Portal permissions to spin up resources manually by hand.
The Mess: The $28,000 Weekend AI Experiment
The ticket-ops approach didn’t stop security leaks or budget overruns—it just hid them from the repository history.
Over a long weekend in February 2024, a developer working on an AI prototype wanted to test model training speeds. Knowing that opening a ticket would delay his test by a week, he logged into the Azure Portal directly and manually provisioned a 16-node Standard_ND96asr_v4 GPU cluster.
He finished his test on Friday evening, logged off, and went on vacation.
He forgot to delete the cluster.
# The Azure Portal resource created outside IaC tracking:
# SKU: Standard_ND96asr_v4 (8x NVIDIA A100 GPUs per node)
# Hourly Rate: $32.40 per node * 16 nodes = $518.40 per hour
# 72 Hours Weekend Run Time = $37,324.80 Total Spend!
On Tuesday morning, the billing alert triggered: the unapproved weekend test had generated a $37,300 USD invoice in 72 hours.
Manual ticket gates had completely failed. They had slowed down legitimate work while failing to stop catastrophic rogue deployments.
The Solution: The Automated DevSecFinOps Pipeline Factory
We stripped away manual ticket approvals, revoked all direct Azure Portal write permissions, and embedded automated DevSecFinOps Guardrails directly into our GitHub Actions CI/CD pipelines.
We shifted both security and cost validation left—forcing code to prove compliance before it could be merged.
# # GitHub Action DevSecFinOps Governance Pipeline
name: 'DevSecFinOps Pull-Request Gate'
on:
pull_request:
branches: [main]
jobs:
governance-gate:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
# 1. Security Gate: Checkov Static Analysis
- name: Run Checkov Security Scan
uses: bridgecrewio/checkov-action@master
with:
framework: terraform
output_format: cli
soft_fail: false # Hard fail on HIGH/CRITICAL security violations
# 2. FinOps Gate: Infracost Cost Calculation
- name: Setup Infracost
uses: infracost/actions/setup@v2
with:
api-key: ${{ secrets.INFRACOST_API_KEY }}
- name: Generate Infracost Monthly Breakdown
run: |
infracost breakdown --path=. --format=json --out-file=infracost.json
infracost comment github --path=infracost.json --repo=$GITHUB_REPOSITORY --github-token=${{ secrets.GITHUB_TOKEN }} --behavior=update
How the Pipeline Enforces Guardrails
When a developer submits a pull request, the pipeline runs two automated validation passes in sub-90 seconds:
- SecOps Gate (Checkov): Scans the Terraform code. If a developer tries to deploy an unencrypted storage account or open an NSG rule to
0.0.0.0/0, Checkov fails the build immediately and highlights the exact line of HCL code requiring remediation. - FinOps Gate (Infracost): Parses
terraform planbinary output, calculates the exact monthly cost diff, and posts a formatted breakdown directly as a comment on the GitHub PR.
# Infracost PR Comment Output
💰 **Infracost Monthly Cost Estimate:**
- **Previous Cost:** $1,200.00 / month
- **New Cost:** $2,450.00 / month
- **Monthly Net Change:** +$1,250.00 USD (🔺 +104%)
⚠️ **FinOps Policy Warning:** Monthly cost increase exceeds $1,000 threshold.
PR requires `finops-approved` tag to enable merge.
If the monthly cost delta exceeds $1,000 without an explicit finops-approved label applied by a repository administrator, the merge button remains locked.
The Impact
- Deployment Velocity: Reduced PR validation time from 8 business days (manual tickets) to 90 seconds (automated pipeline).
- Zero Portal Drift: Revoked direct Azure Portal write access; 100% of infrastructure changes forced through version-controlled IaC.
- Budget Protection: Blocked 24 over-budget PRs and 42 critical security misconfigurations before code reached production.
Key Takeaway
Shift Security and Cost Enforcement Left Into CI/CD.
Do not rely on slow manual ticket approvals or post-billing invoice reviews for cloud governance. Embed automated static analysis tools (Checkov) and financial calculators (Infracost) directly into your GitHub Actions pipelines to block non-compliant or expensive code before it ever reaches a merge branch.
Architecture and decisions: mine. Debugging sessions at odd hours: mine. AI assistance: structure, syntax, first draft. — Sachin
Sachin Kumar Sharma
Associate Director (Infrastructure & Cloud Architecture Strategy) | 20+ Yrs Exp
Architecting resilient multi-cloud enterprise landing zones, SDN overlay fabrics, DevSecFinOps automation pipelines, and autonomous Agentic AI platforms.
💡 Related Engineering Articles
The Factory: Building Azure DevSecFinOps at Scale
The Azure ExpressRoute BGP Steering Incident: 3 Weeks of Asymmetric Drops
How a missing local-pref in Terraform caused a £40,000 asymmetric routing loop across dual 10G ExpressRoute links, and how Checkov pipeline rules now prevent it.
Observability on a Budget: Optimizing Cloud Log Ingestion Costs
How we cut an enterprise Azure Log Analytics and SIEM bill by 40% using Edge Data Collection Rules, KQL telemetry tiering, and health-probe filtering.
📬 Stay Updated on Tech Releases
Sign up to get notified when I publish new production war stories, agentic AI architecture blueprints, or open-source infrastructure tools.