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.
| Control | What it does | The gap |
|---|---|---|
| Budgets | Notifications at the thresholds you set | Evaluated every 24 hours; consumption isn't stopped |
| Spending limit | Disables services when the limit is used up | Not available on pay-as-you-go or commitment plans |
| Cost Management | Cost and usage by service and subscription | 8 to 24 hours late on EA and MCA, up to 72 hours on pay-as-you-go |
| Costbrake | Live Azure OpenAI and VM estimates, spike alerts, 2 brakes | An 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