Search code examples
c#azurebotframeworkmicrosoft-teams

How to add authentication to a Bot Framework v4 project without Azure Bot Service?


I'm working on an bot with Bot Framework SDK v4. The plan is to host it on a local server. I've been trying to add authentication with Azure AD to it but I don't want to use the Azure Bot Service. This guide explains how to add authentication but it uses the Azure Bot Service that generates the MicrosoftAppPassword value for the appsettings.json configuration which I need.

What is making me think that using Azure Bot Service is not required is the Bot Framework website where I can register my bot. But I'm not quite sure how to exactly get this to work both with Azure Portal and with the code.

Is there any way to add authentication to a bot for Microsoft Teams without using Azure Bot Service?


Solution

  • This blog post might help to explain how the Bot Framework and Bot Framework Services fit into the picture: https://hilton.giesenow.com/how-bot-calls-actually-work

    In essence, you definitely can't run a Bot Framework bot without the 'Services' part behind the scenes, but that does NOT include the hosting - you can host your bot anywhere you like. In the Azure portal, there are various options when creating a bot (I'm not sure what they're called now, it's a few months since I looked), but one used to be called "Bot Channels Registration", which was basically just the registration in the Bot Framework Services, and the other was "Web App Bot", which included both the registration as well as a hosting model, using Azure Web Apps <- this is NOT required and the other option is perfectly fine, allowing you to host wherever you like, provided it's an httpS web-addressable endpoint.

    With that in mind, you can host the bot anywhere you like, but still tap in to the authentication/SSO/etc. that the framework + services provide.