Your Agents Were Phoning Strangers Behind Your Back. That’s Finally Over.

Until November, every MCP tool call your Foundry agents made bypassed your API Management policies, no logs, no limits, no cost tracking. The public preview that routes them through APIM or AI Gateway isn't…

Your Agents Were Phoning Strangers Behind Your Back. That's Finally Over.

Published .

Here is a sentence that should have ruined someone’s quarter: until this month, an AI agent you deployed in Microsoft Foundry could reach out to an external service, send it whatever context it decided was relevant, pull back a response, and act on it, and none of that traffic appeared in your API Management logs. No rate limit. No auth policy. No cost line. You found out it happened when the bill arrived, or when it didn’t and you got breached instead.

The November 2026 Azure update fixes the plumbing. Foundry Agent Service can now route Model Context Protocol tool calls through an existing Azure API Management instance, or an AI Gateway your org already runs, instead of letting agents dial the tool endpoints directly. It’s public preview. I’ll say that twice because the marketing will forget to.

What was actually calling out

Quick level-set, because “MCP tool” is doing a lot of work in the announcement and most people nod along without a clear picture.

Model Context Protocol is the interface an agent uses to invoke an external capability: web search, a database lookup, a weather API, your internal ticketing system, a payments service. The model decides a tool is needed, formats a call, and something executes it. In Foundry, that “something” was the agent runtime making an outbound request straight to the tool’s endpoint. The request left your governance perimeter the moment it left the runtime.

So think about what rode along on those requests. Prompt context. Retrieved documents. Whatever the model decided was relevant to the task, including data it had no business shipping to a third-party search API. And the control you had over it was roughly the control you have over an employee’s personal phone.

The dialogue I keep having

I’ve had this argument four times this month, so let me just transcribe it.

Skeptic: We’ve been here before. This is just “put a proxy in front of it.” You people reinvent the forward proxy every five years and give it a new acronym.

Partly fair. The pattern is old, centralise egress, inspect, log, throttle. What’s new isn’t the pattern, it’s that the agent runtime finally exposes a setting to honour it. Before this preview there was no supported way to insert APIM into the MCP path. You could firewall the egress IPs and break the agent, or let it run free. “Reinvented proxy” is exactly right, and it’s exactly what was missing. The novelty was never the concept. It was that the concept was unavailable.

Skeptic: Fine. But you’re selling this as “governance.” Routing traffic through a gateway is not governance. Can APIM tell me which tool an agent is allowed to call, per agent, per identity?

No, and I want you to hold onto that irritation because the word “governance” is going to be smeared across every slide about this. What you get is routing and visibility, which is a real upgrade from nothing, and it is not the same thing as fine-grained, per-tool authorization tied to the agent’s identity. APIM sees HTTP traffic. It can rate-limit it, attach an auth policy to the backend, log request and response, and attribute cost by product or subscription key. It does not inherently understand “agent A may use the search tool but not the payments tool.” You can approximate that with separate backends, separate products, and separate policies, but you’re building it, APIM isn’t handing it to you.

Skeptic: So it’s a traffic log with a throttle. Does it stop the agent exfiltrating the customer table into a web-search prompt?

Not out of the box. APIM moves and shapes requests; it does not inspect model intent or payload semantics unless you build content inspection into the policy, and MCP payloads aren’t a format your average WAF rule was written for. You can bolt a Defender for Cloud / WAF path in front, you can log the full request and run detection downstream, you can pattern-match on egregious stuff. But if your mental model is “APIM will catch the agent leaking PII to a third party,” recalibrate. It catches the volume and gives you the evidence. The leak prevention is a separate project that this makes possible, not one it performs.

Skeptic: Then what did I actually gain?

You gained the thing that was missing: a chokepoint. Every outbound tool call now has a place to be counted, authenticated at the backend, throttled, and recorded. That’s the difference between “an agent spent $40,000 calling a metered API in a retry loop overnight” being a surprise versus an alert. It’s the difference between an incident responder having logs and not having them. Unglamorous. Also the whole job.

How the path actually assembles

The configuration order matters, and it’s the opposite of how people try to do it. Build the gateway side first; point Foundry at it last. If you flip that, the agent fails closed and you spend an afternoon blaming the preview.

One, stand up the MCP route in APIM. Define an API fronting the tool backend, attach your policies (rate limit, inbound auth to the backend, logging to a Log Analytics workspace or Event Hub), and confirm it answers before any agent is involved. This is bread-and-butter APIM; the preview doesn’t change how you author it. Verify the backend and route exist:

run.shbash, zsh
# Confirm the API and its backend are wired before Foundry points at them
az apim api list \
  --resource-group rg-platform-apim \
  --service-name apim-shared-prod \
  --query "[].{name:name, path:path, serviceUrl:serviceUrl}" \
  --output table

Two, point Foundry at the gateway-routed endpoint. In the agent/tool configuration you swap the direct tool URL for the APIM-fronted one. From the agent’s perspective nothing changed; it still speaks MCP to a URL. The URL now terminates at your gateway. That’s the entire trick, and it’s genuinely most of the value.

I’m deliberately not pasting a Foundry portal click-path or a backend policy XML block here. It’s public preview, the surfaces will move before GA, and copying a preview config into a runbook is how you earn a 2 a.m. page in March. Read the current Azure Update, use the shapes above, and treat any specific syntax as perishable.

If you want to assert the pattern as a standard rather than a one-off, the durable move is a landing-zone guardrail: a policy that flags Foundry tool configurations pointing at raw external URLs instead of your approved gateway hosts. Model it in audit first and look before you enforce:

run.shbash, zsh
# Dry-run any guardrail assignment before it bites a team
az policy assignment create \
  --name "agent-tools-must-use-gateway" \
  --scope "/subscriptions/<sub-id>" \
  --policy "<your-custom-definition-id>" \
  --what-if

Where this bites you in six months

A few things the announcement won’t dwell on.

Not every tool survives the detour. MCP supports streaming and long-lived interactions, and some tools lean on connection behaviour that a generic gateway hop can disrupt or add latency to. Pilot each tool through the route before you declare the whole estate migrated. Assume at least one “critical” tool will have a protocol or timeout quirk that makes the direct path tempting again. Resist.

The gateway is now a dependency of every agent. You’ve concentrated risk on purpose, that’s the point of a chokepoint, but it means APIM capacity, availability, and the team that owns it are now on the critical path for agent workloads. Size it. Watch it. Don’t let the AI org discover your APIM maintenance window the hard way.

Cost attribution is only as good as your product design. “Cost tracking” shows up in the feature list, but APIM attributes by subscription key and product. If every agent shares one key, your chargeback report says “AI: a lot.” Split keys per agent, per team, or per environment up front, or you’ll be reverse-engineering spend from log queries later.

It requires the gateway you may not have. This routes through APIM or an AI Gateway your org already runs. It does not provision one for you, and spinning up production-grade APIM purely to front MCP traffic is a real project with a real bill. If you don’t have the gateway, the honest prerequisite is “buy and operate a gateway,” not “flip a setting.”

The old world, agents making unlogged outbound calls to whoever they liked, is the one that’s dead, and good riddance. What won isn’t some new governance platform. It’s the boring gateway you’ve run for a decade, finally allowed into a conversation it should never have been locked out of. Treat the preview as what it is: the hook that lets you do the work, not the work itself.