Experimental chat bot for use cases within Microsoft Teams.
- Create an Azure Bot resource (Free tier) as a Single Tenant bot
- Create an Azure App Service resource (free tier)
- Setup deployment via GitHub action
- Push an ASP.NET Core project inspired by official sample code
- Add
MicrosoftApp...
settings via Environment Variables or Azure KeyVault (add newMicrosoftAppPassword
secret to the identity of the Azure Bot resource) - Configure the Azure Bot resource to point to the public endpoint
/api/messages
of the app service
Instead of merely referencing the nuget packages
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.22.9" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.22.9" />
we can reference the code of it instead, to debug the bot framework.
<ItemGroup>
<ProjectReference Include="..\..\..\botbuilder-dotnet\libraries\integration\Microsoft.Bot.Builder.Integration.AspNet.Core\Microsoft.Bot.Builder.Integration.AspNet.Core.csproj" />
<ProjectReference Include="..\..\..\botbuilder-dotnet\libraries\Microsoft.Bot.Builder.Dialogs\Microsoft.Bot.Builder.Dialogs.csproj" />
</ItemGroup>
Once the debugging session has started, we can open a devtunnel.
# devtunnel login -d
devtunnel host -p 7106 --protocol https -a
The public tunnel address we provide as the Messaging endpoint of the Azure Bot Configuration.
Now we can interact with the bot via teams or webchat and debug it within Visual Studio locally.
Add OAuth 2.0 authentication and settings like https://stackoverflow.com/a/77832960 (Generic Oauth 2).
We use the experimental IdentityServer from PermissionedNotes.
To make authentication work with MS Teams, the bot needs to overwrite OnTeamsSigninVerifyStateAsync
to forward the received auth code (received in the form of a Teams-specific invoke action) to the OAuthPrompt
, like explained here.