Share via

Example for On-behalf-of flow in Azure AI Foundry Agents by Entra ID

Brown James 0 Reputation points
2026-02-08T10:51:30.7133333+00:00

I'm working with AI Foundry and try a demo which enables end users to access their own account-specific content (such as Microsoft Graph API data or MCP tools) through the Agent Identity OBO Flow.

Could you please confirm if implementing the OBO flow is currently supported? If it is,is there any workable, reproducible demo to verify the feasibility of end user account access via AI Foundry Agent Identity; or detailed steps and clear guidance are critical to avoid deployment/testing obstacles

https://learn.microsoft.com/en-us/entra/agent-id/identity-platform/agent-on-behalf-of-oauth-flow

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform

{count} votes

1 answer

Sort by: Most helpful
  1. SRILAKSHMI C 15,040 Reputation points Microsoft External Staff Moderator
    2026-02-09T16:25:12.3266667+00:00

    Hello Brown James,

    Welcome to Microsoft Q&A and Thank you for reaching out.

    Do you need an app registration for your own app?

    Yes. Absolutely. Your own application (local app, App Service, web app, etc.) must have its own Entra ID App Registration.

    This app is responsible for:

    • Authenticating the end user
    • Acquiring a user access token (via device code, auth code, etc.)
    • Acting as the OBO client when calling the agent

    Typical setup

    Client app: Your frontend / API

    • App registration with delegated permissions
    • Uses device code or auth code flow

    User signs in

    You get a user access token (JWT) issued by Entra ID

    You do not redirect to Foundry, Foundry is not the login experience, Foundry never authenticates the user directly

    How does my app use the user token to call an Agent API?

    Your app calls the Foundry Agent endpoint and includes the user’s access token in the Authorization header.

    At this point:

    Your app is saying: “This user is calling the agent”

    The agent runtime receives a delegated user token

    This is where Agent Identity OBO begins.

    Agent Identity Blueprint, what is it actually for?

    Think of the Agent Identity Blueprint as:

    “The agent’s Entra identity + trust policy for token exchange”

    It defines:

    Which app registration represents the agent

    Which downstream APIs the agent is allowed to call

    That the agent is allowed to perform OBO token exchange

    You do not exchange tokens yourself for Foundry-managed tools.

    Instead:

    Foundry uses the Agent Identity Blueprint

    Foundry performs the OBO exchange on behalf of the agent

    You configure the blueprint once, You do not pass client secrets to Foundry, Foundry securely executes the OBO flow

    Agent Identity vs OAuth passthrough (this is the key confusion)

    Use Agent Identity when:

    You want the agent to call:

    • Microsoft Graph
    • Azure services
    • MCP tools
    • Fabric, Search, etc.

    You want per-user access control

    You want Foundry to handle OBO securely

    This is what you want for your scenario

    OAuth passthrough is for:

    Forwarding a raw token to an external service

    No OBO exchange

    No enforcement by Foundry

    Limited scenarios

    OAuth passthrough is not recommended for Entra Agent ID flows, It does not give you proper delegated access semantics

    For Foundry project endpoints, choose Agent Identity

    What happens when the agent calls a Foundry service (project endpoint)?

    Flow looks like this:

    User signs in → user token issued

    Your app calls Agent API with user token

    Foundry validates the token

    Foundry uses Agent Identity Blueprint

    Foundry performs OBO token exchange

    Agent calls Foundry services as the user

    You do not create a connection manually for OBO, The identity mapping comes from the blueprint, The connection uses Agent Identity

    Self-hosted MCP server your approach is correct

    For your self-hosted MCP server, you do handle OBO yourself.

    Your setup should be:

    Server app registration

    Expose scopes / app roles

    Trust the agent identity

    Use:

    ConfidentialClientApplication.acquire_token_on_behalf_of()
    

    Flow:

    Agent receives user token

    Agent calls MCP server with token

    MCP server exchanges token via OBO

    MCP server accesses downstream APIs as the user

    This is correct, MASL / MSAL ConfidentialClientApplication is the right approach

    How everything fits together

    Here’s the clean mental picture:

    Your App

    Authenticates the user

    Gets a user token

    Calls Agent API with that token

    Azure AI Foundry Agent

    Receives the user token

    Uses Agent Identity Blueprint

    Performs OBO automatically

    Calls tools / services as the user

    Self-hosted MCP

    Receives a token from the agent

    Performs its own OBO exchange

    Calls downstream APIs

    You configure identity once, then the flow becomes automatic.

    I hope this helps, do let me know if you have any further queries.

    Thank you!


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.