integrations / microsoft-teams

Bringing your code and work to the conversations you care about with the GitHub and Microsoft integration
428 stars 95 forks source link

Teams AI Bot can't find Connection Setting #322

Open JonoSuave opened 1 year ago

JonoSuave commented 1 year ago

Describe the bug I was able to get the Tutorial AI Bot up using OpenAI, and now I want to integrate it with Graph data. When I debug locally in Teams, however, I get the following error: The bot encountered unhandled error: Could not find Connection Setting with name GraphConnectionLocalBot

To Reproduce Repo: https://github.com/JonoSuave/TutorialBot.git

Steps to reproduce the behavior:

  1. Spin up a Teams AI Bot with OpenAI
  2. Instantiate the the app in the index.ts like so:
    const app = new Application<ApplicationTurnState>({
    storage,
    ai: {
        planner,
        moderator,
        promptManager,
        prompt: "chat",
        history: {
            assistantHistoryType: "text",
        },
    },
    authentication: {
        connectionName: config.connectionName,
        title: "Sign In",
    },
    });
  3. Set up an app registration with Graph delegate permissions openid and profile
  4. Provision via Teams Toolkit so the resources are created in Azure, including the Azure bot
  5. Go to the Azure bot created in Azure Portal and navigate to the Configuration Settings
  6. Add your app registration with delegated Graph permissions to the OAuth Connection Settings
  7. Test the connection
  8. Add the name of the OAuth Connection setting to your Teams AI .env file like so: CONNECTION_NAME=GraphConnectionLocalBot
  9. Make sure you add the reference to the teamsapp.local.yml file as well
  10. Debug the application in Edge

Expected behavior To communicate with the AI Bot and to have an authentication popup window display to login the user and grant permissions to their openid and profile data to the bot Screenshot 2023-06-14 at 1 33 02 PM

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

JonoSuave commented 1 year ago

One thing I think would be helpful is to have a reference to how to set up the authentication between the Azure Bot an app registration in Azure Portal