Configuring Microsoft Entra ID
- Applies to
- Gatewayruntime for API, AI, and MCP gateways
- Hosting
- Managed EdgeManaged DedicatedSelf-Hosted
The MCP Gateway can use Microsoft Entra ID (formerly Azure AD) as the identity
provider behind its downstream OAuth flow. The mcp-entra-oauth-inbound policy
is an Entra-friendly wrapper around the generic mcp-oauth-inbound policy:
provide your Entra tenant UUID, a client ID, and a client secret, and the policy
derives the v2 OIDC issuer, JWKS URL, and authorize and token URLs for you.
This guide walks through the Microsoft Entra admin center setup, then wires the policy into a gateway project. Read the authentication overview first for the two-layer OAuth model.
This policy is single-tenant. The multi-tenant aliases common,
organizations, and consumers are not supported because Entra's issuer claim
is tenant-specific and the gateway enforces an exact issuer match. Use a real
tenant UUID.
Set up Microsoft Entra
The MCP Gateway acts as an OAuth 2.1 authorization server in front of Entra. Entra handles browser login; the gateway issues its own access tokens that bind to MCP routes.
Register an application
- In the Microsoft Entra admin center, open Identity → Applications → App registrations and click New registration.
- Give the application a name (for example,
Zuplo MCP Gateway). - Under Supported account types, choose Accounts in this organizational directory only (single tenant). The wrapper does not support multi-tenant modes.
- Under Redirect URI, choose Web and set the value to
https://<gateway-host>/__zuplo/oauth/callback. Click Register. - On the application's Overview page, note the Application (client) ID and the Directory (tenant) ID. Both are UUIDs.
Add a client secret
- Open Certificates & secrets on the application and click New client secret.
- Set a description and an expiration window, then click Add.
- Copy the secret Value immediately — Entra only shows it once.
Add the local development redirect URI
- Open Authentication on the application.
- Add
http://localhost:9000/__zuplo/oauth/callbackunder Web → Redirect URIs. - Save.
Optional: restrict access
By default any user in the tenant can sign in. To restrict access to specific groups, open Enterprise applications, find the same application, and use Properties → Assignment required plus Users and groups assignments.
Wire the policy into the gateway
Add the policy to config/policies.json:
Code
Set the three environment variables in your project's environment configuration. The secret values belong in the project secret store.
Use a national cloud or External ID tenant
By default the policy signs users in on the global Microsoft Entra cloud. Set
cloud when your tenant lives elsewhere:
cloud | Use for | Sign-in host |
|---|---|---|
global (default) | Microsoft Entra ID | login.microsoftonline.com |
us-government | Microsoft Entra ID for US Government | login.microsoftonline.us |
china | Microsoft Entra ID operated by 21Vianet | login.chinacloudapi.cn |
external-id | Microsoft Entra External ID (external tenant) | {tenantId}.ciamlogin.com |
Code
For an External ID tenant, register the application in the external tenant and
use that tenant's ID as tenantId.
If your External ID tenant uses a
custom URL domain,
also set customDomain to that hostname. Users sign in on the custom domain,
and the policy keeps validating tokens against the issuer External ID puts in
them, https://{tenantId}.ciamlogin.com/{tenantId}/v2.0:
Code
customDomain is a bare hostname, without https://, a port, a trailing slash,
or a path. It works only with cloud set to external-id.
Attach the policy to each MCP route in config/routes.oas.json and register the
gateway plugin in modules/zuplo.runtime.ts (see
Configuring Auth0
for the route and plugin patterns — they're identical across all wrappers).
What the wrapper derives
With the default global cloud, the wrapper derives:
| Generic field | Derived value |
|---|---|
oidc.issuer | https://login.microsoftonline.com/{tenantId}/v2.0 |
oidc.jwksUrl | https://login.microsoftonline.com/{tenantId}/discovery/v2.0/keys |
browserLogin.url | https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize |
browserLogin.tokenUrl | https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token |
Other cloud values replace login.microsoftonline.com with that cloud's
sign-in host. With customDomain, only browserLogin.url and
browserLogin.tokenUrl move to the custom domain; oidc.issuer and
oidc.jwksUrl stay on {tenantId}.ciamlogin.com.
Test the configuration
The fastest sanity check is to connect an MCP client:
- Open Claude Desktop, Cursor, Claude Code, or another OAuth-aware MCP client.
- Add a remote MCP server pointing at one of your
/mcp/{slug}routes. - The client should redirect you to the Microsoft sign-in page. After login, the gateway's consent screen renders. Approve it.
- The client receives an access token and can call
tools/list.
If something fails partway through, walk the flow manually using the
manual OAuth testing guide — it exercises every
endpoint with curl so you can see the raw responses.
Common issues
tenantIdrejected at boot. The wrapper accepts only a tenant UUID, not a verified domain,common,organizations, orconsumers. Look up the tenant ID under Overview in the Entra admin center.AADSTS50011redirect URI mismatch. The redirect URI on the app registration doesn't matchhttps://<gateway-host>/__zuplo/oauth/callbackexactly. Match scheme, host, and path.AADSTS700016application not found. The client ID doesn't belong to the tenant the wrapper is configured with. Make suretenantIdandclientIdcome from the same app registration.customDomain is only supported with cloud "external-id"at boot. Custom URL domains apply only to External ID tenants. Setcloudtoexternal-id, or removecustomDomain.- Sign-in fails for a US Government, 21Vianet, or External ID tenant. The
policy is using the global cloud. Set
cloudto match where the tenant lives.