Operational guides for managing Microsoft AI Foundry models: selecting a model, limiting tokens and spend, and getting email alerts when a cost threshold is reached.
- 1. Select and deploy a model
- 2. Limit spend and get an email alert
- 3. CLI: get the resource ID and create the budget
- Optional: hard stop at the cost limit
- Quick decision guide
There are two separate levers: tokens (throughput, controlled per deployment in Foundry) and spend (dollars, controlled in Azure Cost Management). Budgets alert you, they do not hard-stop spend.
In the Microsoft Foundry portal:
- Open your project, go to Deployments (or Models + endpoints).
- Deploy model > Deploy base model > pick the model (for example GPT-4o) > Confirm.
- On the deploy dialog, set the Tokens per Minute (TPM) rate limit. This is your first throughput cap. TPM adjusts in increments of 1,000 and also sets a proportional requests-per-minute limit. Requests over the limit receive HTTP 429.
Change TPM later from Deployments > select the deployment > Edit, or under Management > Model quota.
TPM is a throughput limit, not a price. But it does set the theoretical maximum tokens the deployment could consume if it ran flat out. Multiply those tokens by your model's price per 1M tokens to get a worst-case cost. Real usage is almost always far lower.
| Tokens per minute (TPM) | Max tokens/hour | Max tokens/day (24h) | Max tokens/month (24/7) |
|---|---|---|---|
| 1,000 | 60,000 | 1.44 M | 43.2 M |
| 10,000 | 600,000 | 14.4 M | 432 M |
| 50,000 | 3.0 M | 72 M | 2.16 B |
| 100,000 | 6.0 M | 144 M | 4.32 B |
Example: at 10,000 TPM, the ceiling is about 432 M tokens/month. If your model costs $5 per 1M tokens (illustrative blended rate), the theoretical maximum is about $2,160/month. Substitute your model's actual input/output prices from the Foundry pricing page. Because most workloads run well below the cap, treat this as an upper bound, not a forecast.
Foundry does not bill by dollars, so dollar limits live in Cost Management, scoped to the Foundry resource or its resource group:
- Azure portal > Cost Management + Billing > Cost Management > Budgets > Add.
- Set Scope to the resource group holding your Foundry resource, or filter to the specific AI Services resource under Cost dimension filters.
- Set Reset period (Monthly), the Amount, and the expiration.
- On the alerts step, add one or more % thresholds (for example 50, 90, 100) and the email recipients (up to 5). You can also add Forecasted alerts.
- Create. Emails arrive within about an hour of the threshold being crossed.
Add azure-noreply@microsoft.com to safe senders so alerts do not go to junk.
Reference: Tutorial: Create and manage budgets.
A Cost Management budget cannot target a single model deployment. The finest scope is the whole Foundry (Azure AI Services) resource. For per-model dollar control, isolate the model in its own resource.
Get the Foundry resource ID, then create a budget scoped to that resource with email alerts by deploying the included ARM template. This works the same in Bash and PowerShell.
az login
az account set --subscription "<subscription-name-or-id>"The Foundry resource is a Cognitive Services account. Replace the resource group and account name:
az cognitiveservices account show --resource-group "<resource-group>" --name "<foundry-account-name>" --query id -o tsv
If you only know the name, find it across the subscription:
az resource list --query "[?type=='Microsoft.CognitiveServices/accounts'].{name:name, id:id, rg:resourceGroup}" -o table
Use the included budget.json ARM template. ARM supplies the api-version itself, so it works identically in Bash and PowerShell.
- Edit budget.json: replace
<RESOURCE_ID>and<EMAIL>, and adjust the amount and dates. - Deploy it to the resource group that contains the Foundry resource:
az deployment group create --resource-group "<resource-group>" --template-file budget.json
Notes:
- To budget the whole resource group instead of one resource, delete the
filterblock. - Add a notification block with
"thresholdType": "Forecasted"for an early warning before actual spend reaches the limit.
- Azure portal, open the resource group that contains the Foundry resource (for example
rg-admin-0578). - In the left menu, select Cost Management, then Budgets.
- The budget (for example
FoundryBudget) appears with its amount, Monthly reset, and current spend versus budget. - Click the budget to see the ResourceId filter (scoped to the Foundry resource) and the alert thresholds (for example 90% and 100%) with the notification emails.
Alternative path: Cost Management + Billing > Cost Management > Budgets, then set the scope to the resource group. If it does not appear right away, refresh and confirm the Budgets blade scope matches the resource group you deployed to.
A budget alert does not stop usage by itself. To enforce a cutoff, wire the budget to an Action Group that triggers a Logic App or Automation runbook which, at 100%, disables or deletes the model deployment. Pattern: Manage costs with budgets.
| Goal | Control |
|---|---|
| Cap throughput per minute | Deployment TPM |
| Dollar email alert | Cost Management budget with email thresholds |
| Hard dollar cutoff | Budget + action group + Logic App to disable the deployment |