Foundry agent blueprint & agent identity namse being too long and unable to add to the resources to allow list

Rajender Akula 55 Reputation points Microsoft Employee
2026-05-06T20:02:55.1033333+00:00

Hi team,

We have a requirement to allowlist Foundryagent's SP to access some resources, and when they are trying to add it fails because of SP name being too long.

I cannot use a separate identity created and used for hosted agents, and do not have control over agents identity (blueprint & agent identity).

Is there a way to provide custom name for SP when the agents are getting created?
Help here much appreciated!

Foundry Agent Service
Foundry Agent Service

A fully managed platform in Microsoft Foundry for hosting, scaling, and securing AI agents built with any supported framework or model


Answer accepted by question author
Karnam Venkata Rajeswari 5,340 Reputation points Microsoft External Staff Moderator
2026-05-06T21:27:49.1033333+00:00

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:

  1. A new agent runtime identity
  2. Regeneration of the agent service principal
  3. 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

  1. 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
    This works as there is
    • No dependency on agent identity rotation
    • No allow‑listing updates on every publish
    • Fully supported by Azure DevOps APIs
  2. 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
    Please note that Azure DevOps currently has limited native Entra‑ID–based workload identity support for service‑to‑service scenarios, which is why PATs are often required.
  3. 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
    This allows:
    • Predictable identity
    • Stable allow‑listing
    • Centralized identity and token management

Please note that the following are not supported as of today;

  1. Using a custom UAMI directly inside hosted Foundry agents
  2. Preventing identity regeneration on agent publish
  3. Reusing the same agent identity across publishes
  4. Selecting or overriding identity within agent code

Please let us know if the above response was helpful

Thank you

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Karnam Venkata Rajeswari 5,340 Reputation points Microsoft External Staff Moderator
    2026-05-06T20:27:46.9566667+00:00

    Hello @Rajender Akula

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

    The allow‑list failure occurs because the configuration relies on the service principal display name generated by the Foundry agent blueprint.

    This causes issues because:

    • Display names are system‑generated and can be long
    • They are not guaranteed to be unique or stable
    • They are not intended for authorization or allow‑listing decisions

    In Azure identity and access control scenarios, display names are informational only. Authorization is designed to rely on immutable identifiers which are not names.

    Azure AI Foundry automatically generates and manages service principals for agent blueprints and hosted agents. These identities are fully system‑controlled and follow internal naming conventions to ensure secure lifecycle management and governance.

    At present:

    • Custom or shortened service principal names are not supported
    • The generated service principal name is read‑only and cannot be modified
    • Azure naming policies do not apply to Foundry‑managed service principals

    For hosted Foundry agents, identity is tightly coupled with the platform‑managed execution model. As a result:

    • The agent runs under a Foundry‑managed identity
    • A manually created service principal cannot replace or override this identity
    • Identity selection is not configurable during or after blueprint deployment

    This ensures consistent security boundaries and controlled identity lifecycle management for hosted workloads.

    Please consider implementing the following approaches to update allow‑listing to use stable identity identifiers instead of display names.

    1. Use one of the following:
      • Service Principal Object ID (recommended)
      • Application (Client) ID
      These identifiers are:
      • Fixed‑length GUIDs
      • Unique within the tenant
      • Fully supported for authorization and RBAC scenarios
      Please follow the below steps to retrieve the identifiers:
      1. Open Microsoft Entra ID > Enterprise applications
      2. Select the relevant Foundry agent service principal
      3. Copy either:
        • Object ID or
        • Application (Client) ID
      4. Update the allow‑list using the GUID value
      5. Allow a few minutes for permission propagation
    2. Access model alignment using RBAC wherever applicable Where the target resource supports Azure role‑based access control, manual allow‑listing can often be avoided:
      • Assign roles directly to the Foundry‑generated service principal
      • Scope access at the resource or resource‑group level
      • Use built‑in roles appropriate to the resource (for example, Storage Blob Data Reader or Key Vault Secrets User)
      This approach aligns with least‑privilege principles and avoids dependency on identity display names.

    Please note that:

    1. Foundry‑generated service principal names cannot be modified
    2. Hosted Foundry agents cannot switch to customer‑created identities
    3. The Foundry‑managed identity must be used for execution and access

    The following references might be helpful , please check them out

    Please let us if you have any further queries and if the response was helpful

    Thank you

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

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.