Deploying a Teams bot in Azure using Visual Studio

Deploying a Teams bot in Azure using Visual Studio

·

2 min read

In the previous post I showed you how you can debug your bot locally by using Teams and ngrok. In this post I'm going to show you how to deploy the bot to Azure so that you can share it with others. We're going to do this only with Visual Studio to keep things simple


🔹 Deploying the bot from Visual Studio

  • Right click on the project, then click on Publish

Click on publish

  • Choose Azure as the publish location and click on Next

Choose Azure

  • Choose "Azure App Service (Windows)" and click on Next

Choose "Azure App Service (Windows)"

  • Click on the green "+" button

Click on the green "+" button

  • Choose or create a resource group and a hosting plan

Choose/create resource group and hosting plan

  • Click on Create

  • Wait for the deployment to be complete, and click on Finish once it's done

iClick on Finish

  • Click on Publish

Click on Publish

Once everything is done, you should be able to navigate to the resource group you used for the deployment and see these resources:

Azure resources

We have one more thing to do here, and that is to set our MicrosoftAppId and MicrosoftAppSecret settings inside the app service.

  • Open the app service and go to Configuration -> New application setting

image.png

  • Use MicrosoftAppId for the name and your app id for the value, then click on OK

Add settings

  • Repeat step 10 for MicrosoftAppSecret

  • Click on Save -> Continue

Save settings

  • Grab the URL for the app service, you can do this either from Azure or from the Publish screen in Visual Studio. I added screenshots for both options.

Azure

Azure

Visual Studio

Visual Studio

  • Copy and paste the URL inside the bot Configuration page -> Messaging endpoint. This is really important, make sure you append /api/messages to it

Add messaging endpoint

  • Click on Apply

Now the only thing that's left to do is to communicate with the bot. I already described this in the previous post, but I'll summarize it here: go to our bot resource -> Channels -> Add a featured channel for Teams -> Click on it -> A new browser window will open with MS Teams and our bot conversation.

Bot conversation

The entire process should take less than 10 minutes, but there are other(better) ways of doing this which I'm going to cover in other articles. For now, if CI/CD is not important for you, this method should work just fine.

Did you find this article valuable?

Support Bogdan Bujdea by becoming a sponsor. Any amount is appreciated!

Â