Microsoft Entra Agent ID
Authentication

Choose an authentication protocol for an agent

In brief

The article now maps local, hosted, delegated, and autonomous agents to recommended OAuth flows, including authorization code with PKCE, OBO, client credentials, and agent user-account impersonation. It also adds guidance on client types, instance modes, MSAL, and CIMD.

What Entra admins need to know

Use the updated guidance to select the correct token acquisition path and configure local agents as public clients in single-instance mode.

This editorial summary was generated by AI from the documentation changes. Verify important details in the full Microsoft Learn article.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

Authentication protocols in agentsChoose an authentication protocol for an agent

Agents use OAuth 2.0 protocols with specialized token exchange patterns enabled by Federated Identity Credentials (FIC). All agent auth flows involve multi-stage token exchangesThe right authentication protocol depends on where the agent runs and whose identity blueprint impersonatesit uses to access a resource. Start with these questions:

  1. Does the agent identity to perform operations. This article explainsrun on a user's device or in a hosted service?
  2. Does the agent act for a signed-in user, as itself, or as a dedicated agent user account?
  3. If it acts for a signed-in user, does the agent initiate sign-in or receive a user access token from another application?

Use Microsoft Authentication Library (MSAL) or another supported authentication protocols and token flows used by agents. It covers delegation scenarios, autonomous operations, and federated identity credential patterns. Microsoft recommends that you use our SDKs like Microsoft Entra ID Auth SDK (sidecar) since implementing theselibrary instead of constructing protocol steps isn't easy.

All agent entities are confidential clients that can also serve as APIs for On-Behalf-Of scenarios. Interactive flows aren't supported for any agent entity type, ensuring that all authentication occurs through programmatic token exchanges rather than user interaction flows.requests directly.

[!INCLUDE Use Microsoft SDKs]

PrerequisitesChoose a protocol

Use caseRecommended protocolAccess typeClient type
A local agent runs on an endpoint device and signs in the userAuthorization code flow with Proof Key for Code Exchange (PKCE)DelegatedPublic
A hosted agent receives a user access token from a client application and calls another service for that userOn-Behalf-Of (OBO) flowDelegatedConfidential
A hosted agent runs without a user and accesses resources as itselfClient credentials flow; blueprint impersonation for multi-instance Agent IDsApplicationConfidential
An autonomous agent needs a mailbox or another resource available only to a userAgent's user account impersonationDelegated permissions assigned to the agent's user accountConfidential

If more than one row applies, use a separate token acquisition path for each operating mode. For example, a hosted agent might use OBO for requests initiated by a user and app-only access for scheduled work that doesn't have user context.

The blueprint's instance mode also affects token acquisition. A single-instance Agent ID (preview) uses the shared blueprint client ID directly for authorization code, refresh, client credentials, and OBO requests. It doesn't acquire an intermediate blueprint impersonation token. Single-instance mode isn't limited to local or public clients. For an overview and links to the consent and SDK walkthroughs, see Authentication for a single-instance agent identity. To start with a platform-specific walkthrough, see Choose an integration path for an agent.

Local agent that signs in a user

If you aren't familiar already, go throughChoose the following protocol docs.authorization code flow with PKCE when the agent:

The local agent is a public client. It sends the user to the Microsoft identity platform /authorize endpoint, receives an authorization code at its registered redirect URI, and redeems the code by using a PKCE verifier. It doesn't present a client credential.

A registered public-client Agent ID must use single-instance mode. Every installation uses the same client ID; don't create an Agent ID for each device. A local agent can alternatively use a Client ID Metadata Document (CIMD) URL as its client ID.

Don't use this flow for a hosted agent that receives a user access token from another application. Use OBO instead.

For implementation and protocol details, see:

Supported grant types

The following are the supported grant types forHosted agent applications.

Agent identity blueprint

Agent identity blueprints support client_credentials enabling secure token acquisition for impersonation scenarios. The jwt-bearer grant type facilitates token exchanges in On-Behalf Of scenarios, allowing for delegation patterns. refresh_token grants enable background operations with user context, supporting long-running processes that maintain user authorization.

Agent identity

Agent identities use client_credentials for app-only autonomous operations, enabling independent functionality without user context, and impersonationacts for a signed-in user

Choose the OBO flow when:

  • A client application signs in the user.
  • The client calls the hosted agent or its API with a user agent identity. The jwt-bearer grant type supports both client credential flow and On-Behalf Of (OBO) flow providing flexibility in delegation patterns.refresh_token grants facilitate background user-delegated operations, allowing agent identities to maintain user context across extended operations.

    Unsupported flows

      access token.
    • The agent application model explicitly excludes certain authentication patternsmust call a downstream API with the user's identity and delegated permissions.

    The hosted agent is a confidential client. It doesn't start another interactive sign-in. Instead, it exchanges the incoming user access token for a token to maintain security boundaries. Agents arenthe downstream resource. The incoming token must be intended for the agent's blueprint; don't supportedrelay a token issued for interactive (/authorize) flows, ensuring all authentication occurs programmatically.

  • Public client capabilities aren't available, requiring all agents to operateanother resource.

    For a multi-instance Agent ID, configure the required delegated permissions as confidential clients.

  • A web redirect URI can be configured on a blueprint for consent flows only (response_type=none), but can't be used for interactive token acquisition. Full redirect URI functionality is configuredinheritable permissions on the client application.blueprint and obtain administrator consent.

    Don't use OBO when no signed-in user initiated the operation. Use app-only access for autonomous work.

    For implementation and protocol details, see:

    Core protocol patternsHosted agent that acts as itself

    Agents can operate in three primary modes:Choose the client credentials flow with Agent ID impersonation when the agent:

    • Agents operatingRuns in a hosted service that can protect a credential.
    • Performs scheduled, event-driven, or other autonomous work.
    • Accesses a resource as the Agent ID rather than as a user.

    For a multi-instance Agent ID, the blueprint first authenticates and obtains a token-exchange token for its child Agent ID. The Agent ID then uses that token as a client assertion in the client credentials flow. A single-instance Agent ID instead authenticates directly with the shared client ID and a credential on behalf of regular users in Microsoft Entrathe blueprint. The resource token contains application permissions granted by an administrator and identifies the Agent ID (interactive agents). This isas the actor.

    Use a regular on-behalf-of flow.

  • Agents operating on their own behalf using service principals created for agents (autonomous).
  • Agents operating on their own behalf using user principals created specifically for that agent (for instance agents having their own mailbox).
managed identity and federated identity credential when the hosting environment supports them. Avoid client secrets.

[!INCLUDE Managed identities support]

[!INCLUDE Dont use secrets]

Oauth protocols

There are three agent oauth flows:Don't use application permissions when the resource should apply a signed-in user's permissions or consent. Use authorization code with PKCE or OBO instead.

:::image type="content" source="media/agent-oauth-protocols/agent-flows.png" alt-text="Diagram showing the illustration of oauth flow for agents." lightbox="media/agent-oauth-protocols/agent-flows.png":::For implementation and protocol details, see:

Autonomous agent that acts as a dedicated user

Choose agent's user account impersonation only when an autonomous agent needs capabilities that are available to a user but not to an application identity. For example, an agent might need its own mailbox.

An agent's user account is a dedicated user identity for the agent, not the account of the person using the agent. The Agent ID impersonates this account through an agent-specific token exchange. Access is limited by the permissions assigned to the Agent ID and the agent's user account.

Don't create an agent's user account only to run unattended work. If the resource supports application permissions, prefer app-only access so the workload doesn't depend on behalf of regular users (interactive agents)a user identity.

For implementation details, see:

Related authentication concepts

The following settings affect authentication but don't replace the protocol choice:

  • Public or confidential client describes whether the agent can securely hold a credential. For more information, see Public client and confidential client applications.
  • Autonomous app flow: App-only operations enable agentManaged identity, certificate, secret, or federated identity credential describes how a confidential client proves its identity. Prefer managed identities to act autonomouslyand federated identity credentials when possible.
  • CIMD or registered client ID describes how a public client is identified. Both options can use authorization code flow with PKCE.
  • Refresh token lets a client obtain new access tokens without user context.
  • Agent's user account flow: Agentsrepeating the original authorization. It continues an existing delegated session; it isn't a separate operating on their own behalf using user principals created specifically for agents.model.

Related content

Daily Entra.News

Get daily email updates

Get a concise summary of the latest Microsoft Entra updates delivered straight to your inbox.

Loading the secure signup form…