Azure integration

Azure cost alerts with reversible brakes

Costbrake watches Azure through an app registration that holds no secret: it reads Cost Management, which Microsoft says can take up to 72 hours on pay-as-you-go subscriptions, and adds live estimates for Azure OpenAI tokens, provisioned deployments and running VMs from Azure Monitor every few minutes.

Free checks hourly and sends email. Pro at $12 a month and Team at $39 a month check every 5 minutes, every 2 minutes during a spike, and add 2 brakes an admin confirms by hand: deallocate a VM or turn off API keys on an Azure OpenAI account. Every brake has an Undo.

Azure at a glance

Reads
Cost Management billed costs every 6 hours, posted 8 to 72 hours late, plus live estimates for Azure OpenAI tokens, provisioned deployments and running VMs
Key
No secret: an app registration with a federated credential, Cost Management Reader and Monitoring Reader on each subscription
Setup
Your AI agent runs the az CLI steps, or you create the app registration and paste its tenant ID and client ID
Free plan
Hourly checks, email alerts
Pro and Team
Every 5 minutes
Spike checks
Every 2 minutes for 2 hours after a spike
Brakes
2: deallocate a VM, turn off Azure OpenAI API keys

Brakes

2 brakes for Azure

An admin picks a brake, confirms it, and can undo it later. Brakes come with Pro and Team.

  • Admin confirms

    Deallocate VM

    Shuts the VM down and releases its hardware, so Azure stops billing its compute; a VM that is only stopped keeps billing.

    UndoStarts the VM again if it was running before the brake; a VM that was stopped before stays deallocated.

    Disks and networking keep billing, data on the temporary disk can be lost, a dynamic public IP is released, and Azure can refuse the restart when the region is out of capacity.

  • Admin confirms

    Turn off API keys

    Turns off key authentication on one Azure OpenAI or AI Services account, so every caller using an API key is refused.

    UndoRestores key authentication to exactly what it was before the brake, so the same keys work again.

    Microsoft Entra ID callers keep working, and Microsoft says the change usually reaches every gateway within a few minutes but can take several hours.

Can you set a hard spending limit on Azure?

Not on a pay-as-you-go subscription. Azure budgets send notifications at thresholds, and Microsoft says resources aren't affected and consumption isn't stopped. Budgets are evaluated every 24 hours against cost data that is typically 8 to 24 hours old.

The Azure spending limit does stop services: when charges use up the limit, deployed services are disabled for the rest of the billing period. It isn't available for subscriptions with pay-as-you-go pricing or commitment plans, which covers most production accounts. Details in Azure spending limit and Azure budget alerts.

ControlWhat it doesThe gap
BudgetsNotifications at the thresholds you setEvaluated every 24 hours; consumption isn't stopped
Spending limitDisables services when the limit is used upNot available on pay-as-you-go or commitment plans
Cost ManagementCost and usage by service and subscription8 to 24 hours late on EA and MCA, up to 72 hours on pay-as-you-go
CostbrakeLive Azure OpenAI and VM estimates, spike alerts, 2 brakesAn admin confirms every brake; disks keep billing

How fresh is the Azure data Costbrake sees?

Billed dollars come from Cost Management every 6 hours, per service and subscription, for up to 25 subscriptions. Azure posts costs 8 to 72 hours late, so Costbrake counts a day as final after 4 days.

Live estimates fill the gap. Costbrake reads tokens of OpenAI models on Azure OpenAI and AI Services accounts from Azure Monitor at list price, prices provisioned deployments at the pay-as-you-go PTU-hour rate, and prices allocated VMs at their pay-as-you-go hourly rate from the moment it first sees them. Other models, reservations, savings plans and negotiated discounts only show in billed dollars. For model spend in depth, see Azure OpenAI cost control.

Costs are read in USD only for now. Sponsorship, student and classic CSP subscriptions have no Cost Management data, so Costbrake can't watch them.

Why the Azure connection has no secret

Azure supports workload identity federation, which lets an outside service get an access token without anyone managing a secret. You create an app registration and add a federated credential that trusts Costbrake's issuer with a subject unique to your Costbrake organization. Costbrake signs a short-lived token, and Microsoft Entra ID swaps it for an access token only for apps whose credential names exactly that subject.

Give the app Cost Management Reader and Monitoring Reader on each subscription you want to watch, then paste its tenant ID and client ID. Without Monitoring Reader you still get billed dollars, but no live estimates. Your AI agent can run all of this with the az CLI, as described in agent setup.

How an Azure brake works

Costbrake never brakes on its own. Brakes use a second app registration with the same kind of federated credential and a custom role whose only changes are deallocating and starting VMs and updating Azure OpenAI and AI Services accounts. On Pro and Team, an admin turns the killswitch on for the connection, picks a VM or AI account, types the connection name and clicks Brake now.

  • Deallocating stops compute billing, but managed disks and networking keep billing.
  • VMs with ephemeral OS disks can't be deallocated and are not listed.
  • Callers that sign in with Microsoft Entra ID still reach the AI account after the key brake.
  • There is no brake for other Azure services; for those, Costbrake alerts and you act in the Azure portal.

What triggers an Azure alert

A spike alert fires when an hour costs more than 3 times your 7-day hourly average and at least $5 more, once Costbrake has 24 hours of history. Budget alerts fire at 50, 80 and 100 percent by default, and Pro adds forecast alerts. Free sends email; Pro adds Slack, Discord and webhooks; Team adds PagerDuty. Compare plans on the pricing page.

Questions and answers

Does Costbrake stop Azure spend automatically?

No. Costbrake alerts you, and an admin on Pro or Team decides whether to brake. A brake needs the killswitch turned on for the connection, the connection name typed in, and a click on Brake now. Every brake has an Undo.

Does Costbrake store an Azure client secret?

No. The connection uses an app registration with a federated credential, so you paste only the tenant ID and client ID. Microsoft Entra ID issues Costbrake a short-lived access token each time, and only for an app that trusts your Costbrake organization.

How quickly does Costbrake see Azure OpenAI spend?

Token usage of OpenAI models on Azure OpenAI and AI Services accounts shows up as a live estimate every few minutes, and Pro and Team check every 5 minutes, every 2 minutes after a spike. Billed dollars follow from Cost Management 8 to 72 hours later.

Does a stopped Azure VM still cost money?

Yes, if it is only stopped. Microsoft bills a stopped VM; a deallocated VM has released its hardware and isn't billed for compute, though its disks and networking keep billing. The Costbrake brake deallocates.

Which Azure subscriptions can Costbrake watch?

Up to 25 subscriptions per connection, read in USD. Sponsorship, student and classic CSP subscriptions have no Cost Management data, so Costbrake can't watch them.

Sources

Updated

Start with 14 days of Pro, free

Catch the next Azure spike before the invoice.

14 days of Pro, then Free for 2 accounts. No card needed.