Deploy a Chat BOT to Azure

In this Article, We will have a look at how to deploy the JavaScript Chat BoT to Azure which we have created in our previous Post.
Prerequisites
- JavaScript Bot Created in the previous post
- A Subscription to Microsoft Azure
- Latest version of Azure CLI
Deployment Steps
- Login to Azure
Open a command prompt and run command az login to login to Azure Portal. Browser window will open, allowing you to sign in.

- Set the Subscription
Set the default subscription to use by running following command in command prompt. If you are unsure which subscription you account has, you can view the list of subscriptions by running az account list command.
az account set --subscription "{azure-subscription}"For eg:
- Create an App Registration
We need to create an Registered App in Azure in order to provide BOT access to the BOT Framework service for sending and receiving authenticated message.
Run following command to create and Register App via Azure CLI.
az ad app create --display-name "displayName" --password "AtLeastSixteenCharacters_0" --available-to-other-tenants
Note: Save the appId which will be used as a appId parameter for ARM deployment, and the provided password will be used as the appSecret
- Deploy via ARM template
Use Following command to create a new Resource Group and the respective Resources.
az deployment create --name "{name-of-deployment}" --template-file "template-with-new-rg.json" --location "location-name" --parameters appId="{msa-app-guid}" appSecret="{msa-app-password}" botId="{id-or-name-of-bot}" botSku=F0 newAppServicePlanName="{name-of-app-service-plan}" newWebAppName="{name-of-web-app}" groupName="{new-group-name}" groupLocation="{location}" newAppServicePlanLocation="{location}"
- Fetch Web.config which is needed for Node.js application to work with IIS on Azure App Services. Make sure the Web.config is saved to the root of your bot.
az bot prepare-deploy --code-dir "." --lang Javascript
- Zip the code directory manually and run following command to deploy the code to Azure Web App.
az webapp deployment source config-zip --resource-group "{resource-group-name}" --name "{name-of-web-app}" --src "code.zip"
Test in Web Chat
- Login to Azure Portal
- Click on Resource Groups
- Click on your group
- Click on your Bot Channel Registeration
- Click on Test in Web Chat link in left panel,
- Test your Bot










Comments
Post a Comment