Skip to main content
Use this checklist to connect Copilot Studio to the MCP server with OAuth2 on-behalf-of (OBO). Each user signs in, and the gateway sees each call as both the agent and the user. When you finish, your Copilot Studio agent appears in the TrueFoundry Agent Registry, and its egress and ingress calls go through the gateway with governance applied, including agent identity and RBAC. Want user identity only, without agent identity? Use the DCR checklist instead. Complete these steps for each imported agent.

Steps at a glance

  1. Create app registrations
  2. Configure the identity provider
  3. Enable agent identity
  4. Add the MCP server to the gateway
  5. Grant the agent MCP access
  6. Point the connector at the gateway
  7. Update connector authentication to use OAuth2 OBO

Create app registrations

This section creates two kinds of Entra apps for the gateway hop:
  • truefoundry-app: create this once, per tenant or gateway. It is the shared audience for all agents’ connector tokens.
  • agent-client-<slug>: create one per Copilot Studio agent. It is the connector’s OAuth client. Its app ID appears as the azp claim, which TrueFoundry uses to identify the agent.
Prerequisites: an Entra role that can create app registrations. Cloud Application Administrator covers creating apps and granting admin consent. For the CLI, you need az login and uuidgen.
Copilot Studio’s own Entra Agent ID does not appear in connector tokens.
Each agent has its own connector and agent-client, but all agents share truefoundry-app:

Create truefoundry-app (shared audience)

If the app already exists, skip this section.
Connector tokens are issued for this app, so their aud claim is api://<TFY_APP>. The gateway accepts those tokens.
  1. Go to Entra admin center → App registrations → New registration.
  2. Name the app truefoundry-app, choose single tenant, leave the redirect empty, and select Register. Copy the Application (client) ID. This is $TFY_APP.
  3. Go to Expose an API:
    • Set the Application ID URI to api://<TFY_APP>.
    • Add the scope access_as_user (Admins and users, Enabled). It is a delegated User scope, not an app role.
  4. Under Authorized client applications, add fe053c5f-3692-4f14-aef2-ee34fc081cae (Azure API Connections) with access_as_user.
  5. In the manifest, set api.requestedAccessTokenVersion to 2. This makes tokens use the v2 format, which puts the agent’s app ID in the azp claim. TrueFoundry needs azp to identify the agent. A v1 token doesn’t include it, so agent resolution fails.
  6. Create a client secret for TrueFoundry. It is used for the gateway and MCP Auth Data, not the connector.
  7. No API permissions are needed here. agent-client requests the refresh token (offline_access).
Without Azure API Connections pre-authorized on access_as_user, users see an interactive sign-in on every connector call.

Create agent-client (one per agent)

This is the connector’s OAuth client. Its app ID appears as the azp claim in tokens and as the agent’s Subject value. Don’t configure Expose an API on this app.
  1. Select New registration, name it agent-client-<slug>, and choose single tenant.
  2. Under Authentication → Web, add the redirect URI https://global.consent.azure-apim.net/redirect. If the connector’s Security tab shows an extra redirect URI after you create the connector, add it here too.
  3. Under API permissions (Delegated), add truefoundry-app → access_as_user and Graph → offline_access. Then select Grant admin consent.
  4. Create a client secret for the Power Apps connector. Do not use it in TrueFoundry.
Optional: pre-authorize this agent-client on truefoundry-app under Authorized client applications. Admin consent is enough on its own. Pre-authorization only reduces extra consent prompts.
Without an agent-client for each agent, agent identity is not propagated, and the gateway cannot identify the agent making the call.

Configure the identity provider

Tell the gateway which Entra tokens to accept and how to resolve the agent from azp.
  1. In TrueFoundry, go to Settings → Security & Access → Identity Providers.
  2. Open an existing Entra provider, or select Add Identity Provider.
  3. Set the following fields:
  1. Under Resolve Token To → agent, set:
Do not put agent-client IDs in Allowed audiences. They belong in the agent’s Subject value. For field details, see External JWT.
Without this step, tokens for this agent are not mapped to the agent.

Enable agent identity

Map each agent’s agent-client so that the inbound azp claim resolves to the agent in TrueFoundry.
  1. In Agent Registry, open the agent.
  2. Enable Agent Identity:
  1. Grant Agent Access to the users or teams the agent may act for. This is required when the acting-on-behalf-of slug claim is set. Assign an owner team as well.
The Subject value must be the agent-client app ID. It is not truefoundry-app, not the Copilot Studio AgentIdentityId, and not the connector’s display name.
Without this step, calls from this agent may not be identified as that agent.

Add the MCP server to the gateway

Complete these steps for each MCP server added to the agent.

Register the upstream MCP server

Register the MCP HTTPS endpoint in the gateway. The connector calls the gateway URL for this server.
If the MCP server is already added to the gateway, skip this section. You still need its gateway URL for the connector step.
  1. If the MCP server isn’t registered yet, register it. Getting started: MCP Server Getting Started.
  2. If the MCP server authentication isn’t set yet, open Auth Data and select the method the upstream server expects: API Key, OAuth2, AWS SigV4, or Token Passthrough. See Outbound Authentication to choose.
  3. Save the MCP server.
  4. Copy the gateway URL for the server from How To Use section. You need it in the connector step below.

Create a Virtual MCP Server

You need a Virtual MCP Server only if the remote MCP server uses grant_type: authorization_code. Otherwise, skip this section.
  1. Go to MCP Gateway → Virtual MCP Servers → Create.
  2. Enter a Name and turn on Best Effort Mode.
  3. Add the upstream MCP server as a source, and select the tools the agent should see.
  4. Save, then copy the URL from How To Use section. You use it in Point the connector at the gateway.
For details, see Virtual MCP Server.

Grant the agent MCP access

Registering the server does not authorize tool calls. Grant the agent access to the MCP Server (and Virtual MCP Server) that the connector calls.
  1. In Agent Registry, find the agent.
  2. Go to ⋯ → Manage Permissions.
  3. Select Add Permission → MCP Servers, select the role MCP Server User, select the MCP Server, and save.
  4. Optional: If you created a Virtual MCP Server, repeat step 3 and select the Virtual MCP Server instead.
Without this grant, the gateway returns 403.

Point the connector at the gateway

Create a new custom connector for each agent. It points at this server’s gateway URL and uses this agent’s agent-client. Don’t reuse or change another agent’s connector. TrueFoundry identifies the agent from the token’s azp claim, which comes from the connector’s client ID, so a shared connector gives every agent the same identity. When you build the connector:
  • Use the gateway URL for this server. If you created a Virtual MCP Server, use its URL from How To Use.
  • Split https://<gateway-host>/<gateway-path> into swagger host = <gateway-host> and path = /<gateway-path>, with basePath: /.
  • Build the connector in Power Apps, not in the Copilot Studio MCP wizard.
Keep basePath: / and put the full path under paths:. If you put the path only in basePath, the import succeeds but the server isn’t registered as an MCP operation, so the tool list stays empty.

Create the new gateway connector

  1. Go to Power Apps → Custom connectors → New → Import an OpenAPI file.
  2. Use this definition:
  1. Set the Security tab as described in Update connector authentication to use OAuth2 OBO.
  2. Select Create.
  3. In Copilot Studio, open the agent and go to Tools → Add a tool → MCP. Search for the new connector, select it and create a connection.
  4. Test the new connector. If the agent already had an older connector for this server, remove it from the agent. Then select Publish to apply the changes.
  5. Delete the old connector in Power Apps → Custom connectors only if no other agent uses it.
Without this step, the agent’s MCP calls don’t go through the gateway, so they can’t be governed.

Update connector authentication to use OAuth2 OBO

Configure the connector so Power Platform issues a token with aud = truefoundry-app and azp = agent-client. Before you continue, confirm two things:
  • Azure API Connections is pre-authorized on truefoundry-app.
  • agent-client lists this connector’s redirect URL.
  1. Go to Power Apps → Custom connectors → Security.
  2. Fill in the table above, then select Update connector.
  3. If the connector’s Redirect URL is missing from agent-client, add it.
  4. In Copilot Studio, reconnect (or recreate the connection) so tokens use the new client.
  5. Check the sign-in prompt. A short consent card means on-behalf-of is on. A full sign-in page means it is still off.
Without this step, user and agent identity are not propagated, so the gateway cannot identify the user or agent making the call.

FAQ

No. Use one agent-client per agent. A shared client gives every agent the same azp, so the gateway can’t tell them apart.
Only api://<TFY_APP> and <TFY_APP>. Put each agent-client app ID on the agent as the Subject value, not in Allowed audiences.
The agent-client Application (client) ID, which is the value in the token’s azp claim. Don’t use the Copilot Studio AgentIdentityId.
2. This gives the issuer login.microsoftonline.com/<tenant_id>/v2.0 and puts the agent identity in azp.
So that Copilot Studio can get tokens silently. Without it, users see a sign-in prompt on every call.
Yes. With it on, users see a short consent card, and user claims flow to the gateway. With it off, users see a full sign-in page.