Visual Studio 2019: Publishing Bot application to Azure
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.
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 wiki 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.
Step 1 : Create a new bot or register an existing bot with the Azure Bot Service from here.
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".
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".
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.
Open your App Service in Azure and copy the Microsoft App Id, Microsoft App Password, LUIS Hostname, Key, and AppID values from application settings.
Create a Bot Application using Visual Studio 2019
You can read my previous wiki for setting up a bot development environment in Visual Studio 2019 and create a simple Bot using Visual Studio 2019 from here.
Update AppSeting.JSON File
Open the appsetting.json file from Visual Studio 2019 and paste your MicrosoftAppId, MicrosoftAppPassword, LuisAppID, LuisAPIKey, and LuisAPIHostName.
**
**
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.
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.
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".
Log in and select Service
Log in with Microsoft Azure account, select the existing app service from your resource group, and click OK.
Bot Deploy Confirmation
Copy the destination URL value to the clipboard (you'll need this value later to test the connection to the bot).
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.
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.