Building a chatbot using Azure AKS and Bot Framework
In this post we will be implementing a sample chat bot using .net core, Microsoft Bot Framework SDK hosted on Azure managed Kubernetes (AKS)
While leveraging Azure Web Apps as a host for a chat bot implemented on top of Microsoft Bot Framework would be a preferred choice for various reasons, there are times where you want to host the bot on-premises or even on other platforms supported by Bot Framework SDK on different cloud providers. To explore this option I decided to use one of samples from Azure bot builder repo and use our own Azure AKS as a host.
While I could use ACI and use V3 of Bot builder SDK for this post I decided to go .net core and be platform agnostic and use a Mac and Visual Studio Code to build and deploy to my AKS instance.
As with any bot projects I started with testing the sample locally and ensure that it was running as expected using Bot Emulator, after updating the packages and a simple F5 my sample bot was up and running:
Next it was time to package and deploy this to my AKS instance, as a big fan of Draft what better tool to use! In matter of couple of minutes my project was ready to be pushed to my Azure Container Registry and AKS with a draft create and draft up commands :)
Looking at my AKS dashboard a pod was hosting the app as expected!
While the app was published successfully I needed to apply some changes to the values.yaml for my chart to ensure the app is exposed via public IP and on 443.
Running draft up again quickly updated the pod and our service to be available on 443.
To validate that we can communicate with the end point I updated the setting for the Bot Emulator and confirmed that the bot was operational.
Lastly! I added a new instance of Azure Bot Channel Registeration service on my sub and pointed to my .net core app hosting the logic for my sample bot!
Again in majority of cases hosting your bot backend on Azure Web Apps or Azure Function would be the best option but as you saw in this post Microsoft Bot Framework is very flexible on connecting your audience through various channels back to your business logic on-premises or even on other cloud providers and our hybrid story is the main differentiator when selecting your platform for your chat bots!
As for AKS there would be additional steps to configure a FQDN and SSL which was out of scope for this post.