At its core, the preview allows organizations using Microsoft Foundry Agent Service to route Model Context Protocol (MCP) tool calls through a customer-managed gateway—either the dedicated Azure AI Gateway or Azure API Management (APIM) across supported classic (v1) and v2 service tiers. Instead of letting Foundry agents connect directly to remote MCP servers scattered across internal networks or third-party SaaS platforms, platform teams can place a governed intermediary in front of those servers to enforce authentication, throttling, IP filtering, request routing, and centralized audit logging.
There is, however, a critical operational catch buried in Microsoft’s documentation that will trip up anyone expecting plug-and-play magic: Foundry no longer auto-registers MCP tools with your gateway, and existing tools do not switch over on their own. If an agent is already calling a direct backend MCP endpoint, enabling a gateway on the resource will not silently intercept that traffic.
Why Put a Gateway Between Agents and MCP Servers?
As organizations move from simple chat completions to tool-using agents, the Model Context Protocol has quickly become the standard bridge between models and external data or actions—whether querying repositories, updating tickets, or reading internal APIs. Managing security and consumption inside every individual MCP server or agent project quickly turns into a maintenance nightmare.
Microsoft frames the gateway integration around a hub-and-spoke governance pattern:
- Credential separation: Callers authenticate to the gateway using one set of credentials (such as Microsoft Entra managed identity or a gateway key), while the gateway handles backend authentication to the MCP server separately. Developers never need direct access to backend secrets.
- Unified runtime policies: Administrators can enforce rate limits, IP allowlists, header hygiene, and regional routing at a single choke point rather than re-implementing those rules per tool.
- Centralized visibility: Security and platform teams gain a consistent telemetry stream across teams, projects, and tool providers to track usage and investigate anomalous calls.
- Catalog consistency: Both public- and private-catalog MCP tools in Foundry are supported, provided their configured endpoints route through the gateway.
Still, Microsoft’s own Foundry configuration guidance offers a refreshingly candid reality check: a gateway is optional. Foundry already includes built-in controls for access, deployment policies, quotas, content filtering, tracing, and cost visibility. Adding an external gateway introduces another runtime dependency and an extra operational surface to manage. For a single team running a self-contained project, Foundry’s native guardrails may be plenty; the gateway tax really pays off when multiple teams share approved models and tools across an organization.
Administrators should also keep a separate architectural boundary in mind: routing an agent’s tool calls through a gateway does not automatically route the agent’s internal LLM reasoning calls through that gateway. As Microsoft moderators have noted on Microsoft Learn Q&A, Agent Service model inference requires explicit gateway-backed model configuration if you want LLM traffic governed alongside MCP tool traffic.
The Big Gotcha: Automatic Registration Is Gone
If you tested early previews of Foundry’s gateway integration, forget how it used to behave. Previously, adding an MCP tool through the Foundry portal inside a project behind a gateway could automatically register that MCP server with the gateway and route traffic through it.
Microsoft explicitly warns that this automatic registration behavior has been removed. Foundry will not:
- Automatically register a new MCP server with Azure AI Gateway or Azure API Management.
- Create the backend route for you.
- Rewrite a direct backend MCP server URL into a gateway URL.
- Automatically migrate existing MCP tools to use a newly attached gateway.
In short, governance is strictly opt-in at the endpoint level. If a tool’s configuration still points to the direct backend MCP server URL, traffic will walk right past your gateway policies completely unchecked. Even trickier: if a project connection supplies an endpoint that differs from the tool’s server_url, Foundry uses the project connection endpoint—meaning administrators must audit and update both places when migrating existing tools.
Azure AI Gateway vs. Azure API Management: Picking Your Intermediary
Because Microsoft now offers two overlapping gateways in the Azure ecosystem, choosing where to terminate MCP traffic can feel confusing. Although both share an underlying API Management heritage, they are distinct Azure resource types with separate management portals and design philosophies.
| Capability | Azure AI Gateway | Azure API Management (APIM) |
|---|---|---|
| Azure Resource Type | Microsoft.ApiManagement/aigateways | Microsoft.ApiManagement/service (supported v1 and v2 tiers) |
| Primary Focus | Dedicated control plane for AI models, aliases, and MCP tools | Full API lifecycle management extended with AI gateway capabilities |
| Management Surface | Dedicated AI Gateway portal and CLI (az aigateway) | Azure portal, infrastructure-as-code, and XML policies |
| MCP Capabilities | Supports federated MCP endpoints combining remote MCP servers, OpenAPI APIs, and built-in connectors | Exposes MCP routes alongside standard enterprise HTTP APIs |
| Tracing & Governance Extras | Native OpenTelemetry spans for MCP calls; integrates with Microsoft Agent 365 for MCP server inventory and tool-level blocking | Request/dependency telemetry via Application Insights and Azure Monitor |
For existing APIM shops, Microsoft stresses that API Management is not deprecated and migration to AI Gateway is not required. Existing APIM instances, policies, and connected models keep working. What is changing is the Foundry UI: Microsoft is retiring the legacy preview experience that allowed admins to link APIM instances and set project-level token limits directly inside Foundry. Moving forward, new APIM links cannot be created from Foundry, and APIM policies—including token limits—must be managed directly in the Azure portal or via code. Many enterprises will run both side by side: APIM for traditional business APIs, and AI Gateway for federated MCP tool hubs and agent governance.
Step-by-Step: Governing an MCP Tool in Foundry
Because Foundry no longer builds the bridge for you, setup follows a strict "gateway first, Foundry second" sequence.
1. Check Prerequisites and Permissions
- Gateway route ready: Configure or register the MCP route in Azure AI Gateway or Azure API Management first, and verify that the backend MCP server supports your chosen authentication method.
- Supported authentication: Foundry supports Managed identity (Microsoft Entra), Key-based (API key or token), Custom OAuth identity passthrough, and Unauthenticated connections where appropriate.
- RBAC roles: For AI Gateway, you need access to configure routes and policies in the AI Gateway portal. For APIM, Microsoft specifies the API Management Service Contributor or Owner role on the hosting APIM instance.
2. Grab the Gateway-Routed Endpoint
- In Azure AI Gateway, copy the governed MCP endpoint from the AI Gateway portal (or retrieve the runtime endpoint from your code config).
- In Azure API Management, copy the MCP Server URL from the APIM instance in the Azure portal or your deployment templates.
3. Register or Update the Tool in Foundry
In the Microsoft Foundry portal, choose one of two entry paths:
- Catalog route: Go to Tools > Catalog and select an MCP server entry whose preconfigured endpoint already points through your gateway.
- Custom tool route: Go to Build > Tools > Custom > Model Context Protocol, paste the complete gateway-routed URL (such as
https://<gateway-host>/<mcp-route>rather than the backend server URL), and select the matching authentication type.
If you are updating an existing tool, manually replace its direct URL—and check any linked project connection so neither falls back to the raw backend address. For custom OAuth identity passthrough, double-check that the redirect URL matches your OAuth app registration.
4. Apply Policies Outside Foundry
You do not edit runtime governance policies inside Foundry:
- For AI Gateway: Open the gateway in the AI Gateway portal, navigate to Policies, and configure access, spend, or tool controls.
- For Azure API Management: Open the APIM resource in the Azure portal (or update your infrastructure-as-code) and apply XML policies. Microsoft’s documented examples for MCP routes include
<rate-limit-by-key>to cap calls per IP or user,<ip-filter>to restrict access to trusted subnets,<set-header>to injectX-Correlation-Idvalues for log tracing or strip sensitiveCookieandRefererheaders, and<choose>/<set-backend-service>blocks to route traffic geographically based on request headers.
One critical warning from Microsoft’s policy guide: do not strip Authorization or other required authentication headers unless you are certain the downstream MCP server does not require them, or your agents will start failing with mysterious auth errors.
Verifying Traffic and Troubleshooting Broken Tool Calls
Configuring a gateway URL is only half the job; proving that traffic actually flows through it is what keeps security auditors happy. Before declaring victory, open the agent’s chat interface in Foundry and trigger a live tool call—such as asking a GitHub MCP server to list repositories—then verify the request inside your gateway’s telemetry.
If you are using Azure AI Gateway, remember that logs and traces do not appear by magic: you must configure an observability destination first. Point both the Foundry project and AI Gateway’s traces signal to the same Application Insights resource so OpenTelemetry spans for MCP tool calls and policy evaluations show up in Foundry’s Traces view (expect a two-to-five-minute delay before traces appear). For Azure API Management, verify that an Application Insights logger and diagnostics are enabled—and if APIM’s sampling hides your test calls during validation, temporarily bump sampling to 100%.
When things break during testing, Microsoft’s troubleshooting matrix points to four usual suspects:
- Calls still bypass the gateway: Check both the tool’s configured URL and any associated project connection endpoint. Remember that project connections override
server_urlwhen they differ, and every legacy tool must be updated individually. - Tool calls suddenly fail after enabling APIM policies: Rate limits, overly strict IP filters, or accidental removal of
Authorizationheaders are the prime culprits. Temporarily disable policies to isolate the failing rule, then tighten conditions incrementally. - Custom OAuth passthrough fails at sign-in: Inspect the redirect URL in Foundry and confirm it matches the OAuth application registration exactly.
- Empty telemetry in AI Gateway: Confirm that an observability destination was configured before the test run, and verify the tool isn’t quietly calling the direct backend URL.
The Bottom Line for Cloud and IT Admins
Public Preview support for governing MCP tools behind your own gateway closes a glaring enterprise readiness gap in Microsoft Foundry Agent Service. As organizations hand agents the keys to code repositories, internal databases, and line-of-business APIs, routing MCP traffic through Azure AI Gateway or Azure API Management gives IT teams the centralized authentication, throttling, and audit trail they expect from traditional API gateways.
Just keep two guardrails front and center before rolling this out: first, as an In preview Azure feature, treat it strictly as a non-production testing workflow until Microsoft promotes it to general availability. Second, audit every existing MCP tool and project connection manually—because in this updated Foundry workflow, the gateway only protects the endpoints you explicitly point through it.
References
- (In preview) Public Preview: Govern MCP tools with your own gateway in Microsoft Foundry Agent Service Azure Updates · 2026-11-24T16:50:47Z
- Azure updates | Microsoft Azure azure.microsoft.com
- Govern MCP Tools by Using a Gateway - Microsoft Foundry | Microsoft Learn learn.microsoft.com