A fully managed platform in Microsoft Foundry for hosting, scaling, and securing AI agents built with any supported framework or model
The behavior described matches migration and identity limitations in the current preview. The issues are known side effects of the transition from legacy Agent Applications to the new agents model and publishing flow.
For Issue 1 (BotId does not match instance_identity):
- New agents must have a non-null
agent.identity(unique identity) to be publishable to Microsoft 365/Teams. Legacy agents (withagent.identity == null) and legacy Agent Applications are being phased out in favor of the new model. - There is currently no supported in-place upgrade path that preserves the old identity; the documented guidance is to create a new agent using the same definition. The new agent automatically receives a unique identity and stable endpoint.
- Publishing to M365/Teams requires that the agent’s identity and the publishing metadata are consistent. If the agent does not have a unique identity or the identity is in an inconsistent state, publishing fails with an identity-related error. The official troubleshooting guidance for “Publishing fails with identity error” is to follow the migration guide and ensure the agent has a unique identity.
- The platform explicitly notes that an in-place identity upgrade gesture for legacy agents is “coming soon,” and that Agent Applications are planned for deprecation. During this transition, identity mismatches and the need to recreate agents are expected limitations.
Given the documentation:
- The supported path is to create a new agent (Path 2 / Path 3 in the migration guide) and ensure
agent.identityis non-null, then publish that new agent. - There is no documented mechanism to manually align or override the Bot Service App ID with a rotated
instance_identity, nor to select an arbitrary existing Bot resource in the new publish flow. - When publishing fails with an identity-related error, the prescribed resolution is to follow the migration steps and use a new agent with a valid unique identity.
For Issue 2 (Agent replies not reaching Teams/web chat after migration):
- The documentation confirms that:
- Legacy Agent Applications continue to serve traffic through their existing endpoints.
- New agents use a different, stable agent endpoint (
.../agents/{agent}/protocols/...) instead of the legacy application endpoint. - Published agents do not support streaming responses or citations, but there is no documented functional limitation that would prevent replies from being delivered when the agent is correctly published and the identity is valid.
- When agents are published to M365/Teams and then fail after publishing, the documented root cause is typically missing permissions on the agent’s identity, not a general failure of the reply path. The guidance is to assign the necessary RBAC roles to the agent identity for any Azure resources it accesses.
- For Teams/M365 publishing, a common failure mode is that the agent does not have a unique identity (
agent.identityis null or invalid). In that case, publishing or invocation can fail, and the remedy is again to follow the migration guide and ensure the agent is a “new agent” with a valid identity.
From the available documentation:
- There is no explicit description of the internal Bot Framework authentication wiring (ServiceIdentity vs. User-Assigned Managed Identity) or of the exact token flow for outbound replies.
- There is no documented configuration surface in the Foundry portal to switch the Bot Service to use User-Assigned Managed Identity or to manage client secrets for the auto-created bot.
- The docs treat the Bot Service creation and wiring as an implementation detail of the publishing flow; the supported knobs are at the agent level (identity, endpoint, permissions), not at the bot-auth level.
Answers to the specific questions, based only on documented behavior:
- There is no documented way to control or inspect how the auto-created bot’s credentials are configured. The platform requires that the agent has a unique identity and uses that identity for publishing; credential wiring for the Bot Service is not exposed as a supported configuration surface.
- When an agent works in Foundry but fails after publishing, the documented cause is typically identity or permissions (for example, missing RBAC roles on the agent identity). The official guidance is to:
- Ensure
agent.identityis non-null (new agent, not legacy). - Assign required RBAC roles to the agent’s identity for any Azure resources it accesses.
- If publishing fails with an identity error, follow the migration guide and recreate the agent as needed. The documentation does not describe or expose any internal mechanism for Bot Framework authentication beyond these identity requirements.
- Ensure
- The documentation does not state that the publish flow supports configuring Azure Bot Service to use User-Assigned Managed Identity, nor does it describe any roadmap to switch to that model. The only supported and documented path is to:
- Use new agents with non-null
agent.identity. - Publish via the Foundry portal’s built-in Teams/M365 publishing experience.
- Rely on the platform’s automatic Bot Service provisioning and wiring.
- Use new agents with non-null
In summary, the supported actions are:
- Treat legacy Agent Applications and legacy agents as transitional; do not rely on their identities.
- Create new agents with non-null
agent.identityand use the new agent endpoints. - If publishing fails with identity-related errors, follow the migration guide (Path 2/3) and recreate the agent so that it has a valid unique identity.
- For post-publish failures, verify the agent identity’s RBAC permissions as documented.
Details such as Bot Service App ID/secret management, ServiceIdentity vs. UAMI, and the internal reply token flow are not configurable or documented in the current preview.
References:
- Migrate from agent applications to the new agent endpoint and publishing experience
- Publish agents to Microsoft 365 Copilot and Microsoft Teams
- Configure and share your agent
- Migrate to the new agents developer experience
- Migrate hosted agents to the refreshed public preview
- Foundry agents in Microsoft Agent 365
- Microsoft Foundry publish to Teams Bot service error - Microsoft Q&A
- Teams App / Bot 'Unauthorized' error when responding to an activity - Microsoft Q&A
- Issue with Azure BOT communication with Teams - Microsoft Q&A
- Permission Denied Error in Apps Service - Microsoft Q&A
- Microsoft 365 Copilot Retrieval API errors with Authorization Failed - User does not have valid license - Microsoft Q&A