How to deploy your chatbot in Azure

Hands-on guideline to deploy a chatbot in Azure

--

In my previous article I have explained how to create a chat bot locally using Bot Framework. If you want to get an idea about that please visit my article from here..😊

In this article I’m explaining how to deploy your Java bot in Azure using Azure CLI and azure-webapp Maven plugin.

Prerequisites

  1. You should have an Azure subscription
  2. Install Azure CLI

Firstly you have to create a bot locally and then you have to go to the root directory where the bot was created. Then you have to login to the Azure portal using the command prompt or PowerShell by entering the following command.

If you have not logged in to the Azure portal you will be redirected to the login page. After the login you have to set the subscription. Once you logged into the Azure portal a success response will be displayed in the command prompt and there you can find the subscription name.

Next, you have to set the subscription name

Then you have to create Azure bot registration by executing the following command. In there you have to give a unique name for your bot and a password which contains 16 characters including letters of both cases, numbers and symbols.

available-to-other-tenants is used to enable your bot to work with the Azure Bot Service channels. Make sure to keep the appId from the returned JSON, bot name and password 😋

Now, we will move on to create the bot resource. This can be done through Azure portal as well. But once you create the bot resource through Azure portal , you have to execute a separate command for that. But I’ll be doing it through terminal. To create a bot resource run the following command.

appId — appId which returned after registering the bot

appSecret — password you gave when creating the bot

botname — name of the you gave when creating

groupname — name of the resource group

You can give the Azure Resource Manager template path for the template file path. The ARM template is located in the root directory of the bot project, inside deploymentTemplates folder. If you are creating a new resource group you have to give the path of template-with-new-rg JSON file. If using an existing resource group, provide the path of template-with-preexisting-rg JSON file.

After the bot resource is successfully created you can get a JSON payload including all the details regarding the bot resource. Then what you have to do is , go to the bot project and follow this path..

bot project folder >>src>>main>>resources>>application.properties

there you can find the MicrosoftAppId & MicrosoftAppPassword. Set the values of the appId and the password you gave when creating the bot.

So, now we have completed the bot creation and what we have to do is to deploy the bot to Azure 😁

First execute the following command

Then you have to configure the application using below command and continue by providing the necessary details

Again run the same command and press 1 on your keyboard to enter the details of your Azure Web app. This will configure your pom.xml properly.

Finally execute the following command to complete the deployment

Then the deployed bot will be displayed in the Azure portal under Bot Resources..

--

--