Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform
Hello @Brandon Litton ,
Welcome to Microsoft Q&A .Thank you for reaching out to us.
Based on the current Microsoft Foundry documentation, the key distinction is between Hosted Agent delegated identity/session isolation and downstream OAuth identity passthrough.
Regarding if x-ms-user-identity establish the signed-in user for Toolbox oauth2 or user-entra-token - Not explicitly as an OAuth credential selector.
x-ms-user-identity allows a trusted middle tier to associate a Hosted Agent session with a specific end user. The middle tier must have the UserIdentityImpersonation/action permission.
Therefore , x-ms-user-identity establishes Hosted Agent user/session context; OAuth identity passthrough establishes the downstream authentication context.
For oauth2, is consent/token storage user-specific, and will the MCP receive the user's token - Yes, for OAuth identity passthrough.
It is documented that:
- each user authorizes access through their own consent flow;
- Agent Service securely stores that user's credentials; and
- subsequent MCP calls use those credentials.
Therefore, when OAuth identity passthrough is successfully established, the MCP should receive a user-specific OAuth credential, rather than the shared project or agent identity. ([Microsoft Learn][2])
The remaining undocumented point is whether a middle-tier-supplied x-ms-user-identity automatically selects that user's stored OAuth credential.
For validation, inspect only non-sensitive claims at the MCP, such as:
oid, tid, aud, iss, scp, and roles.
Test two users and confirm that the MCP receives the expected user identity and custom audience.
Regarding if every delegated user require Foundry Agent Consumer or Foundry User- For OAuth identity passthrough, Foundry Agent Consumer is the current least-privilege role. Foundry User also works but provides broader permissions intended for developers. ([Microsoft Learn][2])
The middle-tier service principal separately needs:
- Microsoft.CognitiveServices/accounts/AIServices/endpoints/interact/action
- Microsoft.CognitiveServices/accounts/AIServices/agents/endpoints/UserIdentityImpersonation/action
The latter is not included in the current built-in roles and requires an appropriate custom role. ([Microsoft Learn][1])
So, the fact that the middle tier directly invokes the Hosted Agent does not eliminate the Foundry Agent Consumer requirement for users participating in OAuth identity passthrough.
Regarding if a custom private MCP use user-entra-token or oauth2 -
For a customer-owned private MCP with its own Entra audience, custom oauth2 is the recommended approach.
Microsoft restricts managed OAuth tokens scoped to known Microsoft audiences from being sent to custom or third-party MCP endpoints. Custom OAuth allows the organization to use its own Entra app registration and controlled audience.user-entra-token should be used where the target service supports Microsoft's documented managed user-token/audience model.
Regarding if Toolbox can forward account ID, office ID and application role -There is no documented generic Toolbox mechanism for injecting arbitrary business attributes such as accountId or officeId into the OAuth credential.
The recommended security pattern is:
Validated OAuth token > tid / oid / validated scopes & roles >Trusted entitlement store >Account + Office + Application authorization >MCP operation
Application roles can be used when present in validated token claims. Account and office permissions should normally come from trusted server-side entitlement data rather than client-supplied values.
For the requirement that authorization be enforced independently on every tool call, the recommended architecture is:
Teams user >Trusted middle tier >Hosted Agent>Toolbox custom OAuth2
Private MCP>Token validation + entitlement lookup>User / Account / Office authorization>Business services
The MCP must remain the final authorization boundary and independently validate every tool invocation:
- user (oid/tid);
- token issuer and audience;
- scopes/roles;
- account entitlement;
- office entitlement; and
- requested operation.
This prevents authorization from relying solely on the model, session, x-ms-user-identity, or client-supplied business identifiers.
The following references might be helpful , please check them out
- Set Up MCP Server Authentication - Microsoft Foundry | Microsoft Learn
- Hosted agent permissions reference - Microsoft Foundry | Microsoft Learn
- Isolate hosted agent sessions per user - Microsoft Foundry | Microsoft Learn
- Manage hosted agent sessions - Microsoft Foundry | Microsoft Learn
- Connect agents to MCP server endpoints - Microsoft Foundry | Microsoft Learn
- Manage hosted agent sessions - Microsoft Foundry | Microsoft Learn
Please let us know if the response was helpful
Thank you