Deploying Bot Application To Azure Using Visual Studio 2019

Introduction

Bot Framework enables you to build bots that support different types of interactions with users. You can design conversations in your bot to be freeform. Your bot can also have more guided interactions where it provides the user choices or actions. The conversation can use simple text strings or more complex rich cards that contain text, images, and action buttons. And, you can add natural language interactions too which let your users interact with your bots in a natural and expressive way.

Deploying Bot Application To Azure Using Visual Studio 2019
 

Setting up the development environment

In order to follow along with this article, you will need the following apps and accounts.

  • Microsoft Account (MSA) – Use your existing account, or click here to create a new account.
  • Visual Studio 2019 IDE – Available for free download here
  • Azure Account – Use your MSA Account to sign-in to the Azure Portal
  • Download the Bot Framework V4 Emulator for your platform from the GitHub releases
  • You can read my previous article for Getting Started with Bots Using Visual Studio 2019 from here

Register Bot Application

After installing and configuring all of the above-listed software and accounts, continue to the below steps.

Ste1

Create a new bot or register an existing bot with the Azure Bot Service from here.
 
Deploying Bot Application To Azure Using Visual Studio 2019

Step 2

Click the "Sign in" button and login with Azure credentials.

Step 3

Click on "Create Web App Bot".

Step 4

On the next screen, click on "Create".
 
Deploying Bot Application To Azure Using Visual Studio 2019

Step 5

You can provide the following information in Web App Bot and create a new Microsoft App Id and password and click on "Create".
 
Deploying Bot Application To Azure Using Visual Studio 2019

Once it's completed, it will generate the application endpoint URL and appID and four services will be created automatically in the Azure portal, as follows.

  • App service
  • APP service plan
  • Web app bot
  • Application insights.

Deploying Bot Application To Azure Using Visual Studio 2019

Open your App Service in Azure and copy the Microsoft App Id, Microsoft App Password, LUIS Hostname, Key, and AppID values from application settings.
 
Deploying Bot Application To Azure Using Visual Studio 2019
 

Create a Bot Application using Visual Studio 2019

You can read my previous article for setting up a bot development environment in Visual Studio 2019 and create a simple Bot using Visual Studio 2019 from here.

Deploying Bot Application To Azure Using Visual Studio 2019

Update AppSeting.JSON File

Open the appsetting.json file from Visual Studio 2019 and paste your MicrosoftAppId, MicrosoftAppPassword, LuisAppID, LuisAPIKey, and LuisAPIHostName.

Deploying Bot Application To Azure Using Visual Studio 2019

Run the bot application in local emulator

Let us start testing our bot application locally, using Bot Emulator. Open the emulator and click "Configure New Bot". Then, provide the local endpoint URL and AppId and password.

Deploying Bot Application To Azure Using Visual Studio 2019

Publish Bot Application into Azure App Service

Once tested our application locally, now, we can publish the bot application to Azure. Right-click on Bot Project > Publish and start publishing the bot application into Azure.

Deploying Bot Application To Azure Using Visual Studio 2019

Visual Studio Azure Publish Wizard

Azure has auto-created the App service while creating web app chat. So, select Microsoft Azure App Service > Existing and click on "Publish".

Deploying Bot Application To Azure Using Visual Studio 2019

Log in and select Service

Log in with Microsoft Azure account, select the existing app service from your resource group, and click OK.

Deploying Bot Application To Azure Using Visual Studio 2019

Bot Deploy Confirmation

Copy the destination URL value to the clipboard (you'll need this value later to test the connection to the bot).

Deploying Bot Application To Azure Using Visual Studio 2019

The following screen will display the web publish activity status, as well as, the Site URL. Once the service is published, it will redirect and open the browser.

Deploying Bot Application To Azure Using Visual Studio 2019

Test Bot Application on Azure Portal

We have completed all the steps to publish the application using VS 2019. You can open your Azure portal and navigate to your Web App Chat channel and click "Test in Web Chat".

Deploying Bot Application To Azure Using Visual Studio 2019

Summary

I hope you have understood how to deploy a bot application to Azure portal using Visual Studio 2019. If you have any question/ feedback/ issues, please write in the comment box.