Hi Brendan
A while ago I ran into this exact 500-error when trying to publish an agent from Azure AI Foundry to Teams and Microsoft 365 Copilot, and the issue was not the agent itself. It turned out to be a combination of missing RBAC permissions and a backend publishing failure on Microsoft’s side.
Here are the things I followed to fix it:
- Make sure the App Registration has the required permissions The app you’re publishing must have a service principal in the tenant and the following roles assigned at the resource group level (minimum):
Cognitive Services OpenAI Contributor
Cognitive Services User
Bot Channels Registration Contributor
Application Administrator (for the publish step)
The publishing step needs rights to create or update the Bot Service registration in your tenant.
- Verify Azure Bot Service exists and is healthy Your screenshot shows a bot name, but make sure:
The bot resource actually exists
The bot is linked to the same app registration (client ID matches)
The Messaging endpoint is valid (even if it’s not used yet)
If the bot is missing or mismatched, the publish step fails with a 500 error.
- Check Teams Admin Center policies In your tenant, make sure:
Custom apps are allowed
Uploading apps is enabled
App publishing is not restricted to specific groups
If these policies block publishing, AI Foundry returns a 500 instead of a clear error.
- Retry after a few minutes There are still backend issues with the preview publishing pipeline. Sometimes the Publishing API responds with 500 even when permissions are correct. Retrying after a few minutes often succeeds.
- If it keeps failing, open a support ticket