Ozgur Karahan AI Solution Engineer at Microsoft Back to the homepage

Identity propagation for AI agents

Agents should act as the person who asked.

When an AI agent reads or changes business records, the system of record should see the signed-in user, apply that user's permissions and record that user's name. This page explains the pattern behind three public samples, and where it stops.

The shortcut that hides who acted

Many agent integrations call business systems with one shared service account. It works in a demo. In production, every lookup and update lands in the audit log as the same technical user, whoever asked.

That account also has to cover anything any user might do, so it collects everyone's permissions and bypasses the per-user rules the systems already enforce. When someone asks who changed a record, a shared credential has no answer.

Shared service accountIdentity propagation
Audit trailEvery action shows the integration accountEvery action shows the signed-in person
PermissionsOne credential with the union of everyone's accessEach request carries only that user's access
AuthorizationRebuilt in middleware, or skippedEnforced by each system, for each caller
TraceabilityHard to tie an AI action to a personIndividual accountability in the data path

How the identity travels

The user signs in once. The same identity then rides along on every hop, and each hop checks it before passing the request on.

  1. Sign in onceThe person signs in with Microsoft Entra ID, in Teams, Microsoft 365 Copilot or a web chat.
  2. The agent calls tools with the user's tokenA Microsoft Foundry agent chooses the tools and calls them, through the Model Context Protocol (MCP), with the user's token rather than its own credential.
  3. A gateway checks and exchanges the tokenAzure API Management validates the token, then obtains a token for the same person in the target system, for example with the OAuth 2.0 on-behalf-of flow.
  4. Each system applies its own rulesSalesforce sharing rules and field-level security, ServiceNow access controls or your own API decide what this person may see and change.
  5. The record names the personWrites show the user, such as Last modified by in Salesforce or Created by in ServiceNow, not an integration user.
Architecture detail: one Azure API Management gateway checks the user's Entra ID token and exchanges it for that user's tokens in Salesforce and ServiceNow, reached through two MCP servers.
Architecture detail from the Customer 360 sample: one gateway, the same user in Salesforce and ServiceNow.

Public samples to inspect

Each one is separately scoped. Their repositories document the exact flows, policies and setup.

Carry identity. Still enforce permissions.

Propagation gives every system the right subject. It does not make the rest of the design safe on its own.

Before adapting a sample

These are a proof of concept and sample implementations, not audited production guarantees. Review identity mapping, token validation, permissions, secrets, logging and failure behavior against your own requirements before adapting them.

Go further

The architecture story behind the Salesforce sample covers the design decisions in more depth.