THR902 · Theater
Take control of runaway AI costs with AI Gateway
Speakers: Mike Budzynski
Microsoft’s player cannot open a video at a given time: once it plays, skip to the time shown.
What the session covers
Mike Budzynski, Principal Product Manager, presents Azure AI Gateway, generally available as of two days before the session. The service mediates AI traffic from users, agents and agent apps to models and backends in Microsoft Foundry, AWS Bedrock, OpenAI, Anthropic, Google Cloud and others. The session frames cost control as monitoring with attribution, budget enforcement and optimization. Most of the session is a demo: importing Foundry and Bedrock models, OpenTelemetry monitoring with an estimated cost metric, Azure RBAC model access, model aliases with session affinity, priorities, weights and failover, cross-provider auto model selection, and a per-identity cost limit policy that blocks a caller once the budget is exceeded.
Best for: Platform and FinOps teams that run agents or apps against several models or cloud providers and need cost attribution, budgets and cost-aware routing in one place.
New material starts at 01:54. The intro covers the agenda and three cost problems; at 01:54 the speaker introduces the newly GA Azure AI Gateway and its feature set.
Where to skip: Skip to 01:54 for the product overview. The technical core is the routing demo at 08:04 (aliases, session affinity, priorities, failover) and cross-provider auto model selection at 15:12. Budget enforcement is at 19:55. The setup demo at 04:21 is basic, and the recap at 22:14 can be skipped.
Chapters (8)
- 00:01 Recap Depth 100 · Novelty 0/3
Agenda and the three AI cost problems: visibility, enforcement, discipline
Mike Budzynski, Principal Product Manager for Azure AI Gateway, introduces the agenda. He describes rapid AI adoption and a fragmented landscape of models, agents, harnesses, teams and providers. He frames AI cost control as three steps: monitoring with attribution (who spends how much on which models and providers), budget enforcement across all clients, and optimization within the budget.
- 01:54 New Depth 200 · Novelty 3/3
Azure AI Gateway GA: mediating AI traffic across Foundry and other cloud providers
Azure AI Gateway is presented as a new service, generally available as of two days before the session, that mediates calls from users, agents and agent applications to models, tools and AI backends in Microsoft Foundry, AWS Bedrock, OpenAI, Anthropic, Google Cloud and others. Monitoring uses OpenTelemetry logs, traces and metrics, including an estimated cost metric calculated from observed tokens and public pricing, plus a built-in dashboard and alerting. Enforcement centres on the cost limit policy (gateway-wide or per model), and optimization on automated model selection powered by model router, priority-weighted routing and session affinity. The speaker positions the gateway as a layer on top of provider-native controls, useful in particular for multi-region Foundry or multi-provider setups.
- 04:21 Demo Depth 200 · Novelty 2/3
Demo: adding Foundry models, enabling OpenTelemetry monitoring and RBAC model access
In a support-case agentic app for a fictional pharma company, the speaker opens the new AI Gateway portal and imports four models from a Microsoft Foundry resource with one click. He enables monitoring to an existing Application Insights resource (any OpenTelemetry destination is also possible), including token claims for attribution. The first call fails with access denied; he grants himself runtime invocation access through Azure RBAC, after which the call succeeds. The dashboard then shows token usage, switchable token aggregation (aggregate or provider-native token types), and a cost of 0.3 cents attributed to his Entra identity.
- 08:04 Demo Depth 300 · Novelty 2/3
Demo: AWS Bedrock model, aliases, session affinity, priorities, weights and failover
The speaker imports an open-source 120B GPT model from AWS Bedrock using a Bedrock key and tests it in the developer catalog via the Responses API with his Entra identity. He creates a 'support assistant' alias that abstracts the Foundry GPT-6 Sol model and the Bedrock model, configures session affinity with a default CEL expression reading common agent-harness session headers so cached tokens are reused, and explains priorities (use pre-provisioned capacity before pay-as-you-go) and weights (capacity-proportional splitting or A/B testing). A default failover rule retries on status codes 400–600 and excludes the backend for half a minute. Testing shows the highest-priority model answering, and flipping priorities makes the cheaper Bedrock model respond.
- 13:24 Demo Depth 300 · Novelty 2/3
Demo: cost attribution by alias, backend and identity, plus request traces
The agentic app now calls the support assistant alias. The dashboard attributes spend to the alias, to specific backend models and to caller identities, mixing Microsoft Entra ID identities and API keys. In the traces experience the speaker confirms the request resolved to the highest-priority Bedrock model and shows the trace waterfall through gateway components and a correlated log with token counts, caller identity and routing details.
- 15:12 Demo Depth 300 · Novelty 2/3
Demo: cross-provider auto model selection by quality or cost objective
The speaker enables auto model selection on the alias, powered by Microsoft Foundry model router, with objectives balanced, quality or cost and an option for clients to override the objective. Unlike Foundry model router alone, it works across providers, here choosing between Bedrock and Foundry deployments. With three dimensions there are six routing-option orders; he configures auto model selection first, then session affinity, then priority. A complex poem prompt under the quality objective goes to GPT-6 Sol despite its lower priority, and a 100-word summary under the cost objective goes to the cheaper Bedrock model; the model-selection OpenTelemetry span in Application Insights shows the objective and the ranked model list.
- 19:55 Demo Depth 200 · Novelty 2/3
Demo: cost limit policy blocks a caller after exceeding a 1-cent monthly budget
With cost at 2.2 cents, the speaker opens gateway policies, which include a token quota policy and the cost limit policy, enforceable gateway-wide per identity or on a specific model or alias. He sets a default budget of 1 cent per month per identity and notes that individual identities, such as a mission-critical agent, can be given overrides. The policy is not retroactive; after a complex prompt to the more expensive GPT-6.1 Sol model, the next request is blocked. The policies tab in monitoring shows one blocked request from one caller identity, with the outcome 'blocked by policy' due to the cost limit policy, and total cost at 3.5 cents.
- 22:14 Closing Depth 100 · Novelty 1/3
Recap: monitor, enforce, optimize; get started at ai.gateway.azure.com
The speaker sums up the demo: OpenTelemetry logs, metrics and traces for attributing cost to caller identities, backend models and aliases; the cost limit policy for budget enforcement; and routing features (priorities favouring cheaper models, session affinity, auto model selection) for optimization. He points to ai.gateway.azure.com, says it is free to start with and generally available as of two days earlier, and invites questions.
Announcements (7)
-
Azure AI Gateway
New service that mediates calls from AI clients to models, tools and AI backends across Microsoft Foundry and other providers, with central monitoring, enforcement and optimization.
two days before the session
Speaker’s quote (at 01:54)
„Azure AI Gateway is a new service now generally available as of two days ago. It mediates calls from AI clients.“
-
Estimated cost metric
Metric that estimates model spend per request from observed tokens and publicly available pricing.
Speaker’s quote (at 02:27)
„Notably, the estimated cost metric that allows you to estimate the spend on models on each request.“
-
Cost limit policy
Gateway policy that enforces a budget gateway-wide or on a specific model.
Speaker’s quote (at 02:54)
„For enforcement, the key feature is the cost limit policy. Cost limit policy allows you to enforce a budget“
-
AI Gateway portal
New portal for Azure AI Gateway aimed at both platform teams and developers.
Speaker’s quote (at 04:46)
„This is a brand new portal for Azure AI gateway. for both platform teams and for developers.“
-
Model aliases
Client-facing model name that abstracts multiple backend models, including models from different providers.
Speaker’s quote (at 09:08)
„You can think of an alias as a client-facing model name that abstracts all the backend models for you.“
-
Session affinity
Pins an agentic session to the backend model used before so cached tokens are reused, with the session key extracted by a CEL expression.
Speaker’s quote (at 09:38)
„Session affinity allows you to pin your authentic session to a specific backend model that was used before. so that you reuse cash tokens“
-
Auto model selection in Azure AI Gateway
Selects the best model for a prompt given a balanced, quality or cost objective, across all supported models and providers in the gateway, powered by Microsoft Foundry model router.
Speaker’s quote (at 15:12)
„The power of that feature compared to Microsoft Foundry model router itself is that it works across providers, across all the models in your gateway that are supported.“
Demos (5)
-
A platform team connects Foundry models to the gateway, turns on cost monitoring and controls who may invoke which models, so the support agent app can make its first attributed call.
Steps (7)
- Open the AI Gateway portal and add models from Microsoft Foundry by selecting a Foundry resource (here with four models).
- Enable monitoring and select an existing Application Insights resource (or another OpenTelemetry destination).
- Enable monitoring of token claims for attribution and save the configuration.
- From the client app, call a model (GPT-6 Luna) and observe the access denied error.
- Assign runtime invocation access to all models or a specific model in the gateway using Azure role-based access control.
- Call the model again from the app and receive a response.
- Open the built-in dashboard, switch token aggregation method if needed and narrow the time range to the past hour to see cost attributed to the caller identity.
Prerequisites: Azure AI Gateway, a Microsoft Foundry resource with deployed models, an Application Insights resource or other OpenTelemetry destination, permission to assign Azure RBAC roles, and a client app authenticating with Microsoft Entra ID.
-
A platform team adds a model from another cloud and puts it behind a single alias with session affinity, priority routing and failover, so the application has no single point of failure and can prefer cheaper or pre-provisioned capacity.
Steps (9)
- Add a model from AWS Bedrock by supplying the Bedrock key and selecting only the open-source 120B GPT model.
- Open the catalog experience, choose the Responses API, authenticate with your Microsoft Entra identity and test the Bedrock model.
- Create an alias named support assistant and select the GPT-6 Sol Foundry model and the Bedrock model as backends.
- Configure session affinity using the default CEL expression (or customise it) to extract the session key from request headers.
- Set weights to a one-to-one ratio and assign the Foundry model the higher priority so Bedrock is used only for failover.
- Keep the default routing option (session affinity vs. priority group order).
- Add a failover rule with the default expression: retry on status codes 400–600, then exclude the backend for half a minute.
- Test the alias in the catalog and confirm GPT-6 Sol responds.
- Flip the priorities to prefer the Bedrock model, test again and confirm the Bedrock model responds.
Prerequisites: Azure AI Gateway, a model deployed in your AWS tenant in AWS Bedrock with a Bedrock key, a Microsoft Foundry model deployment, and runtime invocation access via Microsoft Entra identity.
-
A platform team verifies which backend served a request and attributes spend to aliases, models and callers.
Steps (4)
- Point the agentic application to the support assistant alias and investigate a support case.
- Open the monitoring dashboard and break down spend by alias, backend model and caller identity (Entra ID and API keys).
- Open the traces experience, select the request and check which backend model it resolved to.
- Review the trace waterfall and the correlated log with token counts, caller identity and routing details.
Prerequisites: Monitoring enabled on the gateway (Application Insights in the demo) and an alias configured as in the previous step.
-
Developers get the cheapest model that can do the job, or the strongest model for complex prompts, across providers behind a single alias.
Steps (7)
- Edit the support assistant alias and enable auto model selection.
- Choose the objective (balanced, quality or cost); select quality and optionally allow clients to override the objective.
- Remove the failover rule.
- Resolve the save error by choosing a routing option: auto model selection first, then session affinity, then priority.
- Send a complex prompt and confirm in the response that GPT-6 Sol was selected despite its lower priority.
- Switch the objective to cost, send a simple summarisation prompt from the app and check in the trace that the Bedrock model responded.
- Copy the trace ID, open Application Insights logs in the Azure portal and inspect the model-selection span with the objective and the ranked model list.
Prerequisites: An alias with backend models that are supported by auto model selection, and monitoring to Application Insights for trace inspection.
-
A platform team enforces a per-identity monthly budget so a caller is blocked once spend exceeds it, and reviews the enforcement in monitoring.
Steps (6)
- Open the policies in the gateway and select the cost limit policy.
- Set a gateway-wide default budget per identity (1 cent per month in the demo); optionally override it for specific identities.
- Save the policy.
- From the app, send requests to an expensive model (GPT-6.1 Sol) until spend exceeds the budget.
- Observe that the next request is blocked by the gateway.
- Open the policies tab in monitoring to see the blocked request, the caller identity and the outcome 'blocked by policy'.
Prerequisites: Azure AI Gateway with monitoring enabled; callers identified by Microsoft Entra ID or API keys.