-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Describe the Feedback
Published agents do not use their dedicated Entra ID agent identity for tool authentication. Instead, they continue to use the shared project agent identity, which contradicts the documented behavior.
According to the official documentation, when an agent is published, it should automatically receive a distinct agent identity in Microsoft Entra ID that is bound to the agent application resource. However, in practice, published agents continue to authenticate using the shared project's agent identity (agentIdentityId from the project level) instead of their own dedicated agent identity.
Repro Steps
Steps to reproduce the behavior:
- Go to Microsoft Foundry Portal
- Create and configure an agent with MCP tools that require authentication
- Publish the agent
- Navigate to Microsoft Entra admin center (https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/AllAgents.MenuView/~/allAgentIds) and verify the distinct agent identity was created for the published agent
- In Foundry Portal, create an MCP connection with:
- Authentication: Microsoft Entra
- In Foundry Portal, create an MCP connection with:
- Authentication: Microsoft Entra
- Type: Agent Identity
- Configure API Management with trace logging to capture authentication details from incoming requests
- Invoke the agent using
openai_client.responses.create()withagent_reference - The agent calls the MCP server (hosted on API Management) during execution
- Monitor the incoming requests in API Management trace logs
- Check the
appidclaim in the bearer token sent to the MCP server - Observe that the
appidalways matches the project's shared agent identity instead of the published agent's distinct identity
Expected Behavior:
Published agents should authenticate using their distinct agent identity
Actual Behavior:
Published agents continue to use the shared project agent identity (agentIdentityId from the Project resource), even after being published.
System Information
- Environment: Microsoft Foundry Production
- SDK:
azure-ai-projects>=2.0.0b1 - Python: 3.x
- Authentication: DefaultAzureCredential
Labels
Please include relevant labels such as:
- bug
- Feature Area: Agent Identity, Authentication, Agent Publishing
- Issue: Runtime, Identity Management
- Priority: High (Security & Access Control)
Additional Context
Documentation Reference
From Agent identity concepts in Microsoft Foundry:
Tool authentication
Agents access remote resources and tools by using agent identities for authentication. The authentication mechanism differs based on the agent's publication status:
- Unpublished agents: Authenticate by using the shared project's agent identity.
- Published agents: Authenticate by using the unique agent identity that's associated with the agent application.
When you publish an agent, you must reassign RBAC permissions to the new agent identity for any resources that the agent needs to access. This reassignment ensures that the published agent maintains appropriate access while operating under its distinct identity.
Impact
This issue has several critical implications:
- Security: Published agents may have broader permissions than intended since they inherit the shared project identity permissions
- Audit Trail: Cannot properly track which specific agent performed actions
- Least Privilege: Impossible to implement proper least-privilege access control per agent
- Governance: Cannot apply Conditional Access policies to individual published agents
- Lifecycle Management: RBAC changes intended for the published agent identity have no effect
a custom MCP server hosted on Azure API Management. The MCP server returns mock data with authentication information for testing purposes. API Management trace logging was enabled to capture the authentication token details from incoming requests.
The API Management logs consistently show that the appid claim in the bearer token matches the project's shared agent identity ID, not the published agent's distinct agent identity ID. This confirms that the Foundry Agent Service runtime is not switching to the distinct identity after publication.
Test Setup:
- MCP server endpoint hosted on Azure API Management
- MCP tool configured with
AgenticIdentityTokenauthentication - Agent configured to use the MCP tool
- API Management trace logging enabled
Results from API Management trace:
- Expected
appid:<distinct-agent-identity-id>(from Agent Application JSON view) - Actual
appid:<project-shared-identity-id>(from Project JSON view)
Testing Consistency:
This issue was verified using both invocation methods:
- Python SDK (
openai_client.responses.create()withagent_reference) - Foundry Portal (manual agent invocation through the UI)
Both methods produce identical results - the published agent consistently uses the project's shared agent identity instead of its distinct agent identity. This confirms the issue is in the Foundry Agent Service runtime, not specific to any client implementation.
Code Sample
# Before running the sample:
# pip install --pre azure-ai-projects>=2.0.0b1
# pip install azure-identity
import json
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
myEndpoint = "https://<project-endpoint>.services.ai.azure.com/api/projects/<project-name>"
project_client = AIProjectClient(
endpoint=myEndpoint,
credential=DefaultAzureCredential(),
)
# Get the published agent
agent = project_client.agents.get(agent_name="published-agent-name")
print(f"Retrieved agent: {agent.name}")
openai_client = project_client.get_openai_client()
# Create a conversation to maintain context
conversation = openai_client.conversations.create()
print(f"Created conversation: {conversation.id}")
# Send initial request that will trigger MCP tool
response = openai_client.responses.create(
conversation=conversation.id,
input="Request that triggers MCP tool",
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)
# Process any MCP approval requests
input_list = []
for item in response.output:
if item.type == "mcp_approval_request" and item.id:
print("\nMCP approval requested:")
print(f" Server: {item.server_label}")
print(f" Tool: {getattr(item, 'name', '<unknown>')}")
print(f" Arguments: {json.dumps(getattr(item, 'arguments', None), indent=2, default=str)}")
should_approve = input("Approve this MCP tool call? (y/N): ").strip().lower() == "y"
input_list.append({
"type": "mcp_approval_response",
"approve": should_approve,
"approval_request_id": item.id,
})
# If there were approval requests, send approval response
if input_list:
print("\nSending approval response...")
response = openai_client.responses.create(
input=input_list,
previous_response_id=response.id,
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)
print(f"\nResponse output: {response.output_text}")
# At this point, check API Management trace logs
# The appid claim will show the project's shared identity, not the published agent's distinct identityRequest
Please investigate why published agents are not using their distinct agent identities for tool authentication and ensure the runtime behavior matches the documented specification.