A fully managed platform in Microsoft Foundry for hosting, scaling, and securing AI agents built with any supported framework or model
Hello @Rajender Akula ,
Thank you for the follow up question.
For hosted Azure AI Foundry agents, identity is fully platform‑managed. During execution, the agent runtime is allowed to acquire tokens only for Foundry‑managed identities (blueprint identity or agent identity).
Because of this:
- A custom User‑Assigned Managed Identity (UAMI) cannot be injected or selected at runtime
- Token acquisition for a custom UAMI fails by design
- Identity configuration is not exposed in agent code or deployment settings
This explains the reason for token acquisition that works locally or in isolation, but fails once the agent is deployed and executed in the hosted Foundry runtime.
Foundry agent identities change on publish as each agent publish operation can result in:
- A new agent runtime identity
- Regeneration of the agent service principal
- A different Object ID than the previous publish
This happens because publishing represents a new immutable runtime artifact, and identity rotation is part of the platform’s lifecycle and security model.
As a result:
- Identity‑based allow‑listing tied to a specific Object ID can require updates after each publish
- Relying on static identity names or IDs becomes operationally expensive
The supported best‑practice patterns for ADO MCP access would be
- Using ADO Personal Access Token (PAT) stored securely For calling Azure DevOps MCP / REST APIs from a hosted agent, the most reliable pattern today is:
- Create a least‑privilege ADO PAT
- Store the PAT securely (for example, in Azure Key Vault)
- Retrieve the secret at runtime
- Use PAT‑based authentication for ADO calls
- No dependency on agent identity rotation
- No allow‑listing updates on every publish
- Fully supported by Azure DevOps APIs
- RBAC‑only authorization wherever supported If the downstream service supports Azure RBAC instead of identity allow‑listing:
- Grant access at resource or project scope
- Avoid name‑ or ID‑based allow‑lists entirely
- External execution boundary as an advanced approach For scenarios requiring full identity control:
- Move ADO‑calling logic to an external service (Function App, App Service, Container App)
- Assign a stable UAMI to that service
- Call the external service from the Foundry agent
- Predictable identity
- Stable allow‑listing
- Centralized identity and token management
Please note that the following are not supported as of today;
- Using a custom UAMI directly inside hosted Foundry agents
- Preventing identity regeneration on agent publish
- Reusing the same agent identity across publishes
- Selecting or overriding identity within agent code
Please let us know if the above response was helpful
Thank you