- OIDC · Identity-based LLM — an LLM consumer whose routing is chosen from the
token’s
roles(app roles) orgroupsclaim (roles). - OAuth2 · MCP — an MCP consumer gated by an exposed API scope. Interactive agents (Cursor, etc.) use TrustGate’s authorization-code broker; optional client-credentials tokens are only for curl checks.
api:// resource URI and its bare identifier as the same audience, and prefers
the Entra oid claim as the stable subject. Use the values below exactly.Prerequisites
- An Entra tenant — note your Tenant ID (
Overview → Tenant ID). - Rights to register applications (App registrations) and manage Enterprise applications.
- A group or set of users you can assign to an app role.
- For Cursor / agent MCP login: the public MCP base URL of your gateway (e.g.
https://{gateway_slug}.mcp.neuraltrust.ai), so you can register the OAuth redirect URI.
mcp_base_url: SaaS uses {slug}.mcp.neuraltrust.ai. Private/Hybrid uses the Dataplane MCP URL from Settings → Agent Gateway → General. Register {mcp_base_url}/oauth/callback on the IdP before testing agent login.The values you will collect
1. Register the application
https://entra.microsoft.com (the same
screens exist in the Azure portal under Microsoft Entra ID). Paths below are the
left-hand navigation.Create the registration
- Name:
trustgate - Supported account types: pick the one that matches your tenant.
- Redirect URI (optional at create time; required for interactive MCP): platform
Web, URI
{mcp_base_url}/oauth/callback
(example:https://default-xxxxxxxx.mcp.neuraltrust.ai/oauth/callback)
Add a client secret
Confirm the redirect URI (for Cursor / MCP)
2. Expose an API scope (for MCP)
Set the Application ID URI
api://{client_id}, and Save. This URI is your
audience.Add the scope
- Scope name:
mcp.access - Who can consent: Admins and users (or Admins only) as appropriate.
- Fill the admin/user consent display name and description.
- State: Enabled.
api://{client_id}/mcp.access.3. Define app roles (for identity-based LLM routing)
App roles are the cleanest way to drive TrustGate roles; they arrive in theroles claim.
Create the app role
- Display name:
Engineering - Allowed member types: Users/Groups (and/or Applications for M2M).
- Value:
engineering— this exact string is what appears in therolesclaim. - Description: anything.
- Tick Do you want to enable this app role?
Assign users or groups to the role
trustgate app → Manage → Users and groups → Add
user/group. Pick the users/groups, and under Select a role choose Engineering.
Click Assign.(Optional) emit a groups claim instead
groups array of group object IDs (GUIDs), not names.4. OIDC identity-based routing (LLM)
Use this when an LLM consumer should pick registries and models from the caller’s Entra token (app roleroles, or directory groups). Everything below is done in the
NeuralTrust app under Agent Gateway — no API payloads.
Recommended order: Auth → Role → Consumer.
Create an OIDC auth
- Type:
OIDC - Name: e.g.
entra-idp - Status: Active
- Issuer:
https://login.microsoftonline.com/{tenant_id}/v2.0 - JWKS URL:
https://login.microsoftonline.com/{tenant_id}/discovery/v2.0/keys - Audiences:
api://{client_id}(add the bare{client_id}as well if your tokens use that form) - Subject claim:
oid
(oidis a stable per-tenant user id; Entrasubis pairwise per app and changes across apps)
Create a role that matches Entra app roles
- Role name: e.g.
engineering - Claim:
roles(orgroupsif you emit directory groups instead) - Value: the app role Value from step 3, e.g.
engineering
(for directory groups, use the group object ID GUID, not the display name) - Resources: Add resource and select the LLM registries (and optional models) this role may reach
Create an LLM consumer with Identity-based routing
- Name: e.g.
entra-llm - Protocol:
LLM - Authentication → Method:
OIDC - OIDC provider: select the auth from the first step
- Switch from Static to Identity-based
- Roles: select the role(s) you created (at least one)
5. OAuth2 for MCP
Use this when Cursor (or another MCP client) should log in through Entra. Access is gated by the exposed API scope (for examplemcp.access).
TrustGate accepts either:
- Delegated (user) tokens — scope appears in the
scpclaim (what Cursor uses via the authorization-code broker). - Application (client credentials) tokens — grant an app role as an application
permission, request
api://{client_id}/.default; the granted role appears inroles. TrustGate matches bothscpandrolesagainst Required scopes.
Grant API permission (client-credentials / M2M only)
trustgate API → Application permissions → tick the app role → Add
permissions. Then Grant admin consent for your tenant. Without admin consent the
token carries no roles and TrustGate rejects it for missing scopes.Create an OAuth2 auth in the app
- Type:
OAuth2 - Name: e.g.
entra-mcp - Status: Active
- Setup: Interactive login · IdP with discovery (Okta, Entra ID)
- Issuer:
https://login.microsoftonline.com/{tenant_id}/v2.0 - Audiences:
api://{client_id} - Client ID / Client secret: from the app registration
- Session mode: Disabled
- Required scopes:
mcp.access(the short scope name — notopenid/profile/email)
https://login.microsoftonline.com/{tenant_id}/discovery/v2.0/keys.Click Create Auth.Create an MCP consumer and attach the auth
- Name: e.g.
entra-mcp - Protocol:
MCP - Authentication → Method:
OAuth2(MCP does not use OIDC) - OAuth client: select the auth from the previous step
Connect from Cursor
6. Get a test token (optional M2M)
Client credentials are not what Cursor uses. Use this only to decode a token and confirm issuer, audience, and scopes:access_token and confirm:
iss=https://login.microsoftonline.com/{tenant_id}/v2.0aud=api://{client_id}(or the bareclient_id)roles(app permissions) orscp(delegated) contains your scope/role