Chapter 2 of 6 · Architecture

Azure API Management AI gateway design and implementation

Runtime assurance 4.5 hours in a non-production POC

Chapter 2 of 6

Architecture at a glance#

The caller sends a Microsoft Entra application token and an APIM subscription key. APIM validates both, applies limits and Content Safety, then exchanges the caller authority for its system-assigned managed-identity token. It calls the pinned Foundry agent through the approved backend. Application Insights receives correlation and token metrics without request or response bodies.

gateway-design-record.json records the target scope, backend, identities, network paths, runtime controls, restore path, owners, and readiness gaps. The combined preflight runs its local record check before it reads Azure or proposes the deployment.

APIM validates the caller and applies limits and safety checks before its managed identity reaches the Foundry agent.

Design choices and tradeoffs#

DecisionChosen approachCost and limitation
Client accessEntra application token plus one APIM subscription per workloadClients manage both credentials
Backend identityAPIM managed identity with Foundry Agent Consumer on one agentDirect Foundry access needs its own control
SafetyAPIM Content Safety before the agent RAI policyIt adds latency and a data path
RoutingPrimary backend with one read-safe retrySecondary routing stays disabled
TelemetryCorrelation and token metrics with body logging disabledContent is unavailable for debugging

The retry is safe because the governed agent has a read-only tool.

Architecture guidance#

Session 06

Azure API Management AI gateway design and implementation slide deck