Microsoft Foundry cost controls (24 Nov 2026): budgets that block agent token spend

Add a daily per-agent block to Azure OpenAI agents as a safety net, keep Cost Management for the bill, and handle the budget 429 without retries.

Read time
17 min
Word count
2.9K
Sections
11
FAQs
8
Share
Two colleagues sorting blank cards into trays beside a laptop, under the Microsoft Foundry and Azure logos
On this page · 11 sections
  1. What Microsoft shipped on 24 November
  2. Why a platform budget helps with runaway loops
  3. What a cost control can cover
  4. What the preview does not count
  5. Worked example: a looping agent overnight
  6. Setting one up
  7. Handle the 429 and the alert stream correctly
  8. A four-week rollout plan
  9. Notes for teams in India
  10. How eCorpIT can help
  11. References

Summary. Microsoft Foundry can now stop an agent that overspends. Cost controls, announced in public preview on 24 November 2026, set a budget in US dollars or tokens on a Foundry resource or project, reset it daily, weekly or monthly, and send an alert or block new requests at a threshold you choose. Blocked calls return HTTP 429 with the header x-ms-budget-cause: budget_exceeded. Azure Cost Management budgets work from cost that arrives 8 to 24 hours after usage, and they never stop consumption. The gaps are real: only GPT and OpenAI o-series models are covered, and provisioned throughput, tool charges and hosted agent compute are not counted. In our worked example, a looping agent on gpt-5.4-mini costs $41.40 an hour at list price. A $50 daily block stops it after about 72 minutes, although a reset during the night can release a second $50. Our verdict: add per-agent daily blocks to Azure OpenAI agents as a safety net, and keep your existing limits while this is a preview.

About this article. This is for platform engineers, FinOps practitioners and engineering leads who run agents or model deployments in Microsoft Foundry. On 2 December 2026 we checked the features, limits, headers, roles and prices against the Azure update record, Microsoft Learn, the Ignite 2026 Book of News, the Azure retail prices API and the European Central Bank's reference rates. We read the documentation and did not test the preview in a live tenant. This is not financial advice, Microsoft changes preview features and prices, and no vendor paid for inclusion. Researched with AI assistance and checked against the primary sources listed in the references.

What Microsoft shipped on 24 November

The Azure update record is dated 24 November 2026 and carries the Microsoft Ignite tag. It lists cost controls as in preview, supporting Azure OpenAI model deployments, with spending totals that are estimates rather than billed figures.

Each cost control combines six parts:

  • Budget. An amount in US dollars, or a number of tokens.
  • Applies to. All usage in the resource or project, or a filtered part of it.
  • Budget sharing. One shared total, or the full amount for each project, agent or session.
  • Reset period. Daily, weekly or monthly.
  • Dates. A start and an end date, saved in UTC.
  • Threshold actions. Send an alert, block usage, or both.

A cost control with no threshold actions only tracks usage in Application Insights, so you can watch a budget before you enforce it. Changes take effect within 15 minutes. The request that crosses a threshold can still finish, so usage can end slightly above the limit.

This is not Agent 365 Cost Management. Microsoft's Book of News places that feature in Microsoft's admin portal, where it covers usage-based services such as Copilot Cowork, Copilot Code, GitHub Copilot CLI and Copilot Studio, with spending policies, limits and alerts in preview. Foundry cost controls live in the Foundry portal and the Azure Resource Manager API, and govern the model tokens your own agents and apps consume.

Why a platform budget helps with runaway loops

Many teams cap agent spend inside application code, with a step counter or a token tally per run. That works until a new agent ships without it, a retry wrapper multiplies calls, or a tool returns an error that the model keeps trying to fix. A platform budget applies to every covered request, whoever wrote the calling code.

Cost Management budgets are evaluated once every 24 hours, against cost data that is itself 8 to 24 hours old. They notify people and can trigger an action group that runs your own automation, but they do not stop consumption by themselves. Quota limits throughput, which can slow a loop but does not end it.

An API Management gateway can enforce a token quota per hour, day, week, month or year with its llm-token-limit policy, and returns 403 when the quota is spent. The policy counts against a key you define and is not tied to a Foundry project by itself. Only traffic sent through the gateway is limited. Token limits set earlier in the Foundry portal are now read-only there, so you edit the policy in API Management.

This table condenses Foundry's own comparison:

Control What it limits Can it block requests Data used
Foundry cost controls (preview) Spending or tokens per reset period Yes, with 429 Usage as requests run
Azure Cost Management budgets Cost per period No, alerts and action groups Cost, 8 to 24 hours after usage
Quota Tokens per minute or provisioned units Throttles above the rate Real time
AI gateway token limits Tokens per minute and a quota per period Yes, 429 for rate and 403 for quota Real time
Azure Policy Which models and deployment types Blocks deployments, not requests Configuration

What cost controls add is a limit in dollars, and one that understands Foundry agents and hosted agent sessions. A gateway quota counts tokens only.

What a cost control can cover

You create a cost control in one of two places:

  • On the Foundry resource, under Manage > Cost > Cost Control. It can cover all usage, or the projects, deployments, agents or sessions you filter to. This suits platform and FinOps owners.
  • In a project, under Monitor > Cost Control. It covers only that project. This suits project leads capping their own spend.

The filters are project, deployment, agent and session, and usage must match all of those you add. On a resource-level control, an agent filter first needs a project filter with exactly one project. A session filter takes up to 20 hosted agent session IDs.

One budget for everything pools all matching usage. A budget per agent, session or project gives each one the full amount. Per-session budgets apply only to hosted agents, and stopping and resuming a session does not reset its count.

A spending budget is in US dollars. A token budget counts all token types, or only input or output, and accepts shorthand such as 10M. You cannot change the budget type after creation, and the portal locks the token types too.

Thresholds can be 50%, 75%, 80%, 90% or 100% of the budget, or an absolute amount. Each action can be added once, and the alert must sit at or below the block. For alerts at both 50% and 75% before a block at 100%, Microsoft suggests a second cost control with the same budget and filters and only an alert action. When several cost controls cover one request, each is evaluated separately and any one that is blocking stops it, so the strictest wins.

What the preview does not count

Read this list before you treat a cost control as your only safeguard:

  • Models. Only GPT and OpenAI o-series models are supported. Claude, DeepSeek and other providers' models are not. A new GPT model usually joins about a week after release, once its price is available to cost controls. Until then spending budgets miss its usage, and it is not added later. Token budgets count it as usual.
  • Provisioned throughput. Provisioned (PTU) deployments are not counted.
  • Model router. Not fully supported, because its cost blends its own charge with that of the model it picks.
  • Instant access. It cannot be targeted on its own, and a deployment filter never covers it.
  • Tools and compute. Agent tool charges, such as web search, and hosted agent compute are not counted.
  • People. There are no budgets per user or per Microsoft Entra group. Use a budget per agent or project, or give each team its own deployment.
  • Fail-open behaviour. If Foundry cannot check a request against its cost controls in time, the request runs.
  • Chat completions in projects. A project's cost controls count chat completions requests but do not block them. To block those, put the cost control on the Foundry resource.

If your agents run on Claude in Foundry, the preview does nothing for them yet. Our guide to Claude on Microsoft Foundry and Consumption Units explains how that usage is billed.

The spending figure is also an estimate. Foundry prices tokens with a snapshot of your negotiated prices, or retail prices where you have none, and does not reconcile the total with your bill during the preview. Because the bill can apply discounts the snapshot misses, such as tiered pricing, Microsoft says the total tends to run slightly high and reach thresholds a little early. The gap can grow over a long period such as a month.

Worked example: a looping agent overnight

Take a support agent on a gpt-5.4-mini Global Standard deployment. A tool starts failing at 18:00 and the agent keeps retrying: 40,000 input tokens and 1,000 output tokens per call, one call every 3 seconds. Azure's retail price in East US 2 is $0.75 per million input tokens and $4.50 per million output tokens, read on 2 December 2026.

  • Cost per call: 0.04 × $0.75 + 0.001 × $4.50 = $0.03 + $0.0045 = $0.0345.
  • Calls per hour: 3,600 ÷ 3 = 1,200, so 1,200 × $0.0345 = $41.40 an hour.
  • Unattended for 16 hours, until 10:00 the next day: 16 × $41.40 = $662.40.

Quota would not necessarily catch it. The loop uses 20 × 41,000 = 820,000 tokens a minute, below the 1,000,000 default for this model on a Tier 1 subscription. A Cost Management budget might not see the cost until after the night is over.

With a daily spending budget of $50 per agent, an alert at 80% and a block at 100%:

  • The alert fires at $40, after about 40 ÷ 0.0345 = 1,159 calls, roughly 58 minutes in.
  • The block lands at $50, after about 50 ÷ 0.0345 = 1,449 calls, roughly 72 minutes in.
  • The agent stays blocked until the next reset, unless you raise the budget, change what the control covers or delete it.

Watch the reset. A daily budget starts again every day, so a loop that nobody fixes starts spending again too. The documentation does not state the daily reset time, but dates are saved in UTC, the period in Microsoft's sample alert ends at midnight UTC, and the portal shows the next reset under the Resets field. If your budget resets at midnight UTC, that is 05:30 in India. The 18:00 to 10:00 night then spans two budget days in India or the UK, and costs about $100 rather than $50. At the ECB rates of 1 December 2026, crossed to ₹92.50 per US dollar and rounded to two decimals, $100 is ₹9,250.00 and the unchecked $662.40 is ₹61,272.00. To hold the loop at one budget, route the 80% alert to someone who can switch the agent off, or add a weekly cost control with a tighter total.

Caching lowers the figures. Our sum assumes no cached input. Prompt caching is on by default for supported models, and a loop that resends the same prefix may hit it. Cached input for this deployment costs $0.075 per million tokens. If all the input were cached, a call would cost 0.04 × $0.075 + $0.0045 = $0.0075, or $9.00 an hour, and the $50 block would take about 5.6 hours to land. A token budget avoids that price dependence: at 41,000 tokens a call, a daily limit of 50M tokens is reached after about 1,220 calls, or 61 minutes.

The cost control must also be in place at least 15 minutes before the loop starts, to be sure it is active.

Setting one up

You need the following:

  1. A role that can create cost controls. Foundry Account Owner, Foundry Owner, Owner and Contributor work for resources and projects. Foundry Project Manager works for projects only. All Foundry roles, and Reader, can view them.
  1. An Application Insights resource selected under Usage data, and read access to it, if you want to see how close each budget is. Alerts and blocks work without it.
  1. For alerts, an Event Grid topic in the subscription that uses the CloudEvents v1.0 input schema and allows key-based authentication, plus the EventGrid Contributor role on it. The schema is chosen on the Advanced page when you create the topic.

Beyond a pilot, create cost controls as code. They are Azure Resource Manager resources of type Microsoft.CognitiveServices/accounts/costControls, or Microsoft.CognitiveServices/accounts/projects/costControls for a project, with API version 2026-11-15-preview. The REST reference does not list them yet. Preview management libraries do include them, from Python 15.1.0b1, JavaScript 9.1.0-beta.1, .NET 1.8.0-beta.1, Java 1.6.0-beta.1 and Go v4.1.0-beta.1.

This is a minimal daily block of $50 for each agent in a project named support, adapted from Microsoft's example:


            {
  "properties": {
    "category": "Cost",
    "amount": 50,
    "timeGrain": "Daily",
    "timePeriod": {
      "startDate": "2026-12-03T00:00:00Z",
      "endDate": "2027-07-01T00:00:00Z"
    },
    "filter": {
      "additionalInfo": { "name": "project", "operator": "In", "values": ["support"] }
    },
    "grouping": [ { "name": "agent", "type": "AdditionalInfoKey" } ],
    "providerProperties": {
      "actions": {
        "Block_GreaterThanOrEqualTo_100_Percent": {
          "type": "Block",
          "operator": "GreaterThanOrEqualTo",
          "threshold": 100,
          "thresholdType": "Percentage"
        }
      }
    }
  }
}
          

Save it as a file and send it with az rest --method put to the Foundry resource's costControls/<name> URL, including the API version. Four preview traps to plan for:

  • Parallel creates can fail. Overlapping requests on one resource can return 409. In a Bicep loop, use @batchSize(1).
  • Every cost control expires. It stops counting at the start of its end date, so put the renewal in your calendar.
  • PUT overwrites. A request with an existing name replaces that cost control. Add the header If-None-Match=* to create only.
  • Project deletion is blocked. A project with its own cost controls cannot be deleted until you remove them. The error is CostControlInUse.

Handle the 429 and the alert stream correctly

A block returns HTTP 429 with x-ms-budget-cause: budget_exceeded. Other headers name the cost control and give the reset time (x-ms-budget-window-reset). When an agent streams its response, the status is 200 and the block arrives as an error event in the stream, so check for that separately.

Two client behaviours need attention:

  • Default retries. The OpenAI Python library retries 429 responses twice by default. A blocked chat completions request currently carries Retry-After: 30, which does not mean the budget clears in 30 seconds, so the call takes about a minute to fail. Turn off automatic retries for these calls.
  • Same status as a rate limit. Some APIs, agents included, can return the same error code for a block as for a rate limit. The x-ms-budget-cause header tells them apart. Back off and retry on a rate limit. On a budget block, stop and escalate.

This adapts Microsoft's sample. Here client is your Foundry client and notify_owner is your own function:


            import openai

try:
    response = client.with_options(max_retries=0).responses.create(
        model="gpt-5.4-mini", input="Summarise the case notes."
    )
except openai.RateLimitError as e:
    if e.response.headers.get("x-ms-budget-cause") == "budget_exceeded":
        reset = e.response.headers.get("x-ms-budget-window-reset")
        notify_owner(f"Agent budget reached; resets {reset}")
    else:
        raise  # quota or rate limit: retry with backoff
          

Alerts need the same care. Events arrive in CloudEvents v1.0 format with the type costControl.alert, and while usage is at or above the threshold, Foundry sends one for every request that counts. In our example, that is about 290 events in the 14.5 minutes between $40 and $50.

The event does not carry the cost control's name. Keep only the first event for each combination of source, limit, threshold and window end, plus the agent or project name for budgets split that way, or give each cost control its own topic. Use the Event Grid connection that Foundry creates when you pick the topic in the portal. Alerts can skip a connection you created yourself without any error.

A four-week rollout plan

  1. Week 1: observe. Create a resource-level cost control with no threshold actions and a budget per project, and learn normal daily usage from Application Insights.
  1. Week 2: alert. Add an 80% alert, deduplicated, to the owning team's channel.
  1. Week 3: block the risky cases. Put a daily per-agent block on autonomous and scheduled agents. We would start at two to three times a normal day's spend. For hosted agents, a per-session budget limits a single run.
  1. Week 4: fix clients and close gaps. Ship the 429 handling. Keep Claude, provisioned and tool-heavy workloads behind gateway quotas or in-code caps, and keep Cost Management for invoices and chargeback.

If you run a gateway in front of Foundry, cost controls still apply after it, and Microsoft recommends the gateway for per-app and per-user token limits. Our enterprise AI gateway comparison covers four options, and our AI cost attribution playbook covers who should own each budget. One related change helps here: Azure billing data includes agent names from November 2026, so you can compare a per-agent budget with the billed cost of the same agent.

Notes for teams in India

Cost controls work in all regions, for models that Foundry bills in that region. Spending budgets are set in US dollars. If you are billed in rupees, work back from the rupee figure you can defend.

A block in the middle of a task is a business event. For a customer-facing agent, decide in advance what the user sees, such as a hand-off to a person, rather than letting the 429 surface as an error. For where this sits among Microsoft's other agent announcements, see our Ignite 2026 recap.

How eCorpIT can help

eCorpIT is a Gurugram-based technology organisation, founded in 2021, assessed at CMMI Level 5 and MSME certified, with senior-led engineering teams working across AWS, Microsoft and Google platforms. Our cloud computing services team can design your Foundry budgets, deploy cost controls as code, and build the alert routing and 429 handling your agents need. Talk to us at /contact-us/.

Last updated: 2 December 2026.

References

  1. Public Preview: Cost controls for model and agent spending in Microsoft Foundry, 24 November 2026 — Azure Updates, Microsoft
  1. Cost controls overview (preview) — Microsoft Learn
  1. Create and manage cost controls (preview) — Microsoft Learn
  1. Tutorial: Create and manage budgets — Microsoft Learn
  1. Azure retail prices API, gpt-5.4-mini meters in East US 2, read 2 December 2026 — Microsoft
  1. Microsoft Ignite 2026 Book of News — Microsoft
  1. Limit large language model API token usage (llm-token-limit policy) — Microsoft Learn
  1. Enforce token limits for models — Microsoft Learn
  1. Azure OpenAI quotas and limits — Microsoft Learn
  1. Euro foreign exchange reference rates, 1 December 2026 — European Central Bank
  1. Prompt caching with Azure OpenAI in Microsoft Foundry Models — Microsoft Learn
  1. Permissions for cost data and cost controls in Microsoft Foundry — Microsoft Learn
  1. Create an Azure Event Grid topic or domain — Microsoft Learn
  1. OpenAI Python API library, README — OpenAI
  1. Cost and FinOps in Microsoft Foundry — Microsoft Learn

Frequently asked

Quick answers.

01 What are Microsoft Foundry cost controls?
They are budgets in US dollars or tokens that you set on a Foundry resource or project, in public preview since 24 November 2026. Each can be narrowed to projects, model deployments, agents or hosted agent sessions. It resets daily, weekly or monthly, and can send an alert or block new requests at a threshold.
02 How is this different from an Azure Cost Management budget?
A Cost Management budget works from cost that arrives 8 to 24 hours after usage, is evaluated every 24 hours and does not stop consumption by itself. A Foundry cost control counts usage as requests run and can block further requests, which suits stopping a runaway agent rather than reporting on one afterwards.
03 Is it the same as Agent 365 Cost Management?
No. Agent 365 Cost Management lives in Microsoft's admin portal and covers usage-based services such as Copilot Cowork, Copilot Studio and GitHub Copilot CLI. Foundry cost controls live in the Foundry portal and the Azure Resource Manager API, and cover model tokens that your own Foundry agents and applications consume.
04 Which models do cost controls support during the preview?
GPT models and OpenAI o-series models are supported. Claude, DeepSeek and other providers' models are not. A newly released GPT model is usually supported about a week after release, once its price is available. Until then spending budgets miss its usage, while token budgets still count it. Provisioned throughput deployments are not counted.
05 What happens to a request when a budget blocks it?
It fails with HTTP 429 and the header x-ms-budget-cause set to budget_exceeded, plus headers naming the cost control and its reset time. Streaming agents get HTTP 200 with an error event in the stream. Requests work again after the next reset, or after you raise the budget or delete the control.
06 Can a cost control give each agent its own budget?
Yes. Choose a budget per agent and every agent covered by the filters gets the full amount, so one looping agent is blocked while the others keep running. Per-session budgets work the same way, for hosted agents only. Budgets per user or per Microsoft Entra group are not available in this preview.
07 Are cost control spending totals exact?
No. Foundry prices usage with a snapshot of your negotiated prices, or retail prices where you have none, and does not reconcile the total with your bill during the preview. Microsoft says totals tend to run slightly high, so thresholds trip a little early. Use Azure Cost Management to reconcile what you actually spend.
08 Should we use cost controls in production now?
Microsoft does not recommend the preview for production workloads and offers no service level agreement. We would still add a daily per-agent block as an extra safety net, after testing how your application handles it. Keep in-code limits and gateway quotas, especially for Claude, provisioned throughput, tool charges and hosted agent compute.

About the author

Manu Shukla

Founder & Director

Founder of eCorpIT. Hands-on engineer leading senior-only delivery for AI apps, custom software, and cloud systems for global clients.

Subscribe

One engineering note a week. No fluff, no spam.

Senior-architect playbooks on AI agents, mobile apps, cloud, security, data, and marketing — delivered every Wednesday.

Past the reading

Read enough. Let's build something.

A senior architect responds in 24 working hours with scope, indicative cost, and a timeline. NDA before any technical conversation.

Weekly engineering notes

Enjoying this article? Get one like it every Wednesday.

Senior-architect playbooks on AI agents, mobile apps, cloud, security, data and marketing. Unsubscribe in one click.

We email a link to confirm your address. Privacy

Loading search…

Browse all guides