Share via

Azure Bot to Foundry Bot connection error!

Bhatt, Nitin 0 Reputation points
2026-03-27T19:58:14.53+00:00

Azure Bot to Foundry Bot connection works fine as 'Test in web chat' feature of Azure bot works. However, the webchat code or directline tries to login to foundry repeatedly with ' Waiting for foundry login to complete' error.

Azure AI Bot Service
Azure AI Bot Service

An Azure service that provides an integrated environment for bot development.


2 answers

Sort by: Most helpful
  1. Anshika Varshney 9,740 Reputation points Microsoft External Staff Moderator
    2026-03-27T20:08:43.0133333+00:00

    Hi Bhatt, Nitin,

    This type of connection error between an Azure Bot and a Foundry Bot usually happens due to configuration or identity mismatch between the two environments.

    Here are a few things you can check step by step.

    First, make sure both bots are using the same Azure Active Directory tenant and subscription. If the Azure Bot was created in a different tenant or subscription than the Foundry project, the connection will fail even if everything looks correct in the portal.

    Next, verify the App Registration linked to the Azure Bot. The Application ID used by the Azure Bot should match the identity configured in the Foundry Bot. Also check that the Client Secret or Certificate is still valid and not expired.

    Another common issue is API permissions. The App Registration should have the required Microsoft Graph permissions, and admin consent must be granted. Without proper consent, the Foundry Bot will not be able to authenticate correctly.

    Also double‑check the messaging endpoint configured in the Azure Bot channel. It should point to the correct Foundry Bot endpoint and environment. Even a small mismatch, like using an old endpoint or a different environment, can cause connection failures.

    If you recently recreated or migrated the bot from Azure Bot to Foundry Bot, try re‑saving the bot configuration and reconnecting it. In many cases, older references or cached values cause the connection to fail until the configuration is refreshed.

    You can also review the bot logs in Azure Monitor or Application Insights. These logs usually show whether the error is related to authentication, permission, or endpoint access, which makes troubleshooting much easier.

    Helpful official references that explain these areas in more detail:

    Once these points are aligned, the connection between the Azure Bot and Foundry Bot should start working as expected.

    I Hope this helps. Do let me know if you have any further queries.

    Thankyou!

    0 comments No comments

  2. Q&A Assist
    2026-03-27T19:58:27.04+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The behavior indicates that the Azure Bot itself and its connection to Foundry work correctly (since Test in Web Chat succeeds), but the custom Web Chat/Direct Line integration is not completing the authentication flow against Foundry.

    From the available information, the supported troubleshooting path is:

    1. Verify the bot works in Azure Web Chat
      • In Azure portal, open the Azure Bot resource.
      • Use Test in Web Chat and confirm that:
        • Messages are processed correctly.
        • Any Foundry-related login or SSO flow completes successfully.
      • Since this already works, the bot and its Foundry connection are functioning in the cloud.
    2. Confirm Web Chat/Direct Line configuration
      • Ensure the Web Chat or Direct Line client is using the correct bot endpoint and credentials by comparing behavior with Test in Web Chat.
      • If using Direct Line, follow the guidance for embedding Web Chat securely:
        • Get the Web Chat secret key from Channels → Web Chat → Default Site.
        • Exchange the secret for a token via the documented token exchange URL, then use that token in the Web Chat control.
      • Any mismatch between the configuration used by Azure’s built-in Web Chat and the custom Web Chat/Direct Line client can cause repeated login attempts.
    3. Check for channel-specific behavior
      • The built-in Test in Web Chat uses the Web Chat channel configuration that is already known to work.
      • If a custom Web Chat or Direct Line client behaves differently (for example, stuck on “Waiting for foundry login to complete”), treat this as a channel-specific issue:
        • Recreate or reset the Web Chat/Direct Line configuration in the Azure Bot Channels blade.
        • Ensure that any authentication or SSO logic in the bot is compatible with the Web Chat/Direct Line channel being used.
    4. Re-deploy and retest in the cloud
      • Confirm the bot is deployed and running in Azure with security enabled.
      • In Azure portal, use Test in Web Chat again to verify that the bot responds correctly with HTTPS and valid credentials.
      • Once confirmed, reconnect the Web Chat/Direct Line client using the same configuration.

    If the loop persists only in the custom Web Chat/Direct Line client while Azure’s Test in Web Chat continues to work, the issue is in the external Web Chat/Direct Line integration rather than the Azure Bot or its Foundry connection. Re-aligning the external client’s configuration with the working Web Chat channel configuration is the supported remediation.


    References:

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.