Azure AI Foundry: Deployment Issues with Teams Bot

Cédric Kaboré 25 Reputation points
2025-06-12T12:26:14.58+00:00

Hello,

I exported a chatbot from my AI Foundry playground for deployment as a Teams app. After inputting my API key and testing the app using the Microsoft 365 Agents Toolkit, everything appeared to work correctly. However, when I provisioned and tested the bot in Teams, it did not respond. Could there be a configuration step that I overlooked? moreover how should i debug in this part without any log

Microsoft Teams Development
{count} vote

Accepted answer
  1. Mr Humayun 155 Reputation points
    2025-06-16T14:12:06.8066667+00:00

    Hi Cédric,

    Thank you for your question! It sounds like you're on the right track, and you're likely encountering a configuration issue related to environment variables or service discovery in your AI Foundry-exported Teams bot.

    Error Explanation

    The error message:

    cpp
    Copy
    Error: Discover::regionGtm::InvalidResponse - searchService is missing in discover response
    

    indicates that the bot is failing to find a required service (likely searchService) during the discovery phase—possibly due to:

    • A missing or incorrect environment variable

    A misconfigured API endpoint or region

    Failure to register or initialize required services


    Suggested Debugging & Fixes

    Here’s how to proceed:

    1. Verify Environment Variables

    Double-check that you have correctly set all required environment variables in your deployment:

    AZURE_OPENAI_KEY

    AZURE_OPENAI_ENDPOINT

    AZURE_SEARCH_SERVICE (if applicable)

    AZURE_SEARCH_INDEX_NAME

    AZURE_SEARCH_API_KEY

    Make sure these are passed correctly into the runtime environment—especially if using Azure App Service or Azure Functions. You can test this locally using .env files and dotenv package.


    1. Check App Registration in Azure

    Ensure the Teams bot is correctly registered with Azure AD:

    Validate App ID, password, and redirect URIs in the Azure portal.

    Verify the Bot Channel Registration includes the Microsoft Teams channel and messaging endpoint is correctly configured.


    1. Enable Logging for Debugging

    You can get visibility into bot runtime errors by:

    Enabling Application Insights on your deployed service.

    Wrapping your handlers with try-catch and printing logs to the console or telemetry.

    Using az webapp log tail or Azure Portal's Log Stream for live logs.


    1. Test with Microsoft 365 Toolkit Logs

    The Microsoft 365 Agents Toolkit includes local testing support—ensure it’s configured for verbose logs:

    bash
    Copy
    npx teamsfx doctor
    npx teamsfx preview
    

    Check for any mismatch in API keys or missing services in logs.


    1. Bot Timeout or Teams Channel Setup

    If the bot doesn’t respond in Teams:

    Confirm messaging endpoint (e.g. /api/messages) is live and accessible.

    Check if App manifest is correctly generated with validDomains.

    Try reinstalling the app in Teams after any config change.


    Let me know I’d be happy to guide you further.

    Best regards,
    Volunteer Contributor – Microsoft Q&A

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.