Search code examples
azurebotframeworkmicrosoft-teamsazure-bot-service

How does Teams know the endpoint of an Azure Bot Service bot when registering it via the AppId/BotId?


My bot is deployed to Azure's Bot Service, I enabled the Teams channel and I have successfully connected it to Teams. However, what I don't get is why it is working! :-)

When setting up the bot in Teams' "App Studio", the UI looks like the screenshot below. I don't use "Select from one of my existing bots", because the bot is deployed using a different user account. Instead, I paste just the AppId of the bot, using "Connect to a different bot id":

enter image description here

My questions are:

  • How does Teams know what the endpoint of the bot is? Is it calling a global (?) bot registry somewhere using the ID as a key?
  • Why does Teams not need the bot's password (when using the Bot Framework Emulator, app ID and password are required)?
    • If I set MicrosoftAppId and MicrosoftAppPassword to non-empty strings in appsettings.json and run the bot locally, I must provide these credentials when using the Bot Framework Emulator, otherwise a 401 is returned.
    • If the bot is deployed to Azure and I connect Teams to it, I never specify the password (see my screenshot) but only the app ID. Still, I can talk to the bot just fine through Teams.
    • If you know my app ID, you can use my bot...?

Solution

  • [Me again :])

    Have a look at my blog post on how bots work 'under the covers' - it will explain how the back and forward works, and how the Bot Framework Services provide this 'glue', so to speak.