Azure API Management AI Gateway: Governing Models, Tokens and MCP Tools

Azure API Management AI Gateway governance integration diagram

Written by Jan Daris

Jan Daris is a hands-on Integration Architect and Developer who enjoys solving complex integration puzzles with Azure, Boomi, APIs, and event-driven architecture. Through this blog, he shares practical knowledge, lessons learned, and real-world solutions to help other architects, developers, and IT teams build better integration platforms.

October 30, 2026

Every team that puts a large language model behind an application eventually hits the same questions: who may call which model, how many tokens may they burn, what happens when a deployment is throttled, and how do we see cost per consumer? Azure API Management answers those questions with its AI gateway capabilities, and since July 2026 also with a dedicated AI Gateway tier in public preview. This guide explains both, and how I would set up governance for models and MCP tools without slowing teams down.

Two ways to get an AI gateway in Azure

AI gateway capabilities in existing tiersAI Gateway tier (public preview)
What it isLLM-specific policies and features inside a regular API Management instanceA separate tier with a control plane organized around models, MCP servers and tools
ConfigurationPolicy XML per API, product or operationPolicy cards per asset in a dedicated portal, plus programmatic options
Best forOrganizations that also need general-purpose API managementPlatform teams that want a focused experience for AI workloads
StatusAvailable across tiersPreview since July 27, 2026; East US 2 and Sweden Central; no cost during preview, pricing to be announced

The AI Gateway tier runs in your own subscription, uses your Entra tenant and sends telemetry to destinations you control. In the preview the policy cards cover request and token rate limits, token quotas, Azure AI Content Safety and fallback to a secondary model. It supports models hosted in Microsoft Foundry as well as AWS Bedrock, Google Vertex AI, OpenAI and Anthropic, and per backend you choose whether the gateway authenticates with no credential, an API key, OAuth 2.0 or a managed identity.

Because it is a preview, I would use the new tier for evaluation and non-critical workloads, and keep production AI traffic on the AI gateway capabilities of an existing API Management instance for now.

The controls that matter, in order

1. Identity first

Authenticate callers at the gateway with Microsoft Entra ID, and let the gateway call the model backend with a managed identity. Applications then never hold model keys, and revoking a consumer is a gateway change, not a key rotation across teams.

2. Token limits and quotas per consumer

Request counts are a poor proxy for cost when one prompt can be a hundred times bigger than another. Use token-based limits: the llm-token-limit policy (and the older azure-openai-token-limit) limits tokens per minute and can enforce token quotas per key, such as a subscription or a team. Size limits per product, not per API, so a chatbot and a batch summarization job do not compete for the same budget.

3. Measure tokens per consumer

Emit token metrics with dimensions such as subscription, product and model using llm-emit-token-metric, and send them to Application Insights. That is the basis for showback or chargeback and for spotting the one integration that suddenly doubles its usage.

4. Resilience across deployments

Model deployments get throttled. Use backend pools with load balancing and circuit breakers so traffic shifts to another deployment or region when one returns 429 or 5xx responses, and keep a fallback model for degraded operation. Decide explicitly whether a fallback model is acceptable for each use case; for some it is better to fail clearly than to answer with a weaker model.

5. Content safety and data rules

Apply Azure AI Content Safety checks at the gateway for user-facing scenarios, and enforce request size limits. Decide which data classifications may be sent to which model and enforce that per product.

6. Caching where it is safe

Semantic caching (llm-semantic-cache-lookup and llm-semantic-cache-store) can cut cost and latency for repetitive questions. Use it only where answers do not depend on the caller’s identity or permissions; a cached answer leaking across users is worse than a slow one.

Governing MCP tools with the same gateway

Agents do not only call models; they call tools. API Management can expose REST APIs as MCP servers and front existing MCP servers, so the same identity, limits and logging apply to tool calls. For the details and how to manage MCP servers as code, see MCP servers in Azure: API Management vs Connector Namespace, and register approved tools in Azure API Center.

A product model that scales

I structure AI access in API Management as products, each with a clear contract:

  • Experimentation – low token quota, smaller models, no production data.
  • Internal assistants – Entra ID per user, content safety on, moderate limits.
  • Integration workloads – service identities, high but fixed token budgets, strict request size limits and no semantic caching.
  • Agent tools – MCP servers with per-agent limits and full call logging.

Teams request a product instead of a model key. That gives the platform team one place to change limits, models and policies without touching application code.

Failure tests before go-live

  • A throttled backend: does traffic move to the next deployment, and does the client get a stable error if all are throttled?
  • A request above the size limit: rejected at the gateway with a clear message.
  • An unauthorized caller: 401 or 403 before any token is spent.
  • A token quota exhausted: the response tells the consumer when it resets.
  • A model timeout: the client receives a defined error contract, not a raw backend error.

Sources

You May Also Like…

0 Comments