Bot Deployment - microsoft-campus-community/workshop-shopping-list-bot GitHub Wiki

Prerequisite: This page assumes that you have a resource group for this workshop in Azure. If you have not worked on the bot yet, start with the Basics first. You will also need the Azure CLI on your development machine.

On this page, you will deploy a working bot to Azure so you can connect it to different messaging channels later. There are different options when deploying a bot. This workshop uses an existing resource group for all the Azure parts used in this workshop. Instead of deploying the files of the bot by hand, you are going to use GitHub Actions. In the real world, you never want to have to deploy software by hand. So, a continuous delivery pipeline is much more realistic and much easier.

Creating Azure resources for the bot

A bot is a web service, so it needs an Azure App Service Plan and an Azure Web App. Also, you will need an Azure Bot Service, which allows you to configure the different messaging channels. You could create these resources by hand. However, every bot created with the Yeoman generator includes Azure Resource Manager (ARM) templates. They define all the resources needed. You find them in the shopping-list-bot/deploymentTemplates folder. Note that in the template-with-preexisting-rg.json file, the free tier is set so that this workshop is free of charge for you. You can always change this. Especially when moving to a production scenario.

  1. Open the Azure CLI and login with az login.
  2. Create an Azure Active Directory App Registration az ad app create --display-name "Shopping List Bot" --password "AtLeastSixteenCharacters_0" --available-to-other-tenants where you replace AtLeastSixteenCharacters_0 with a password that has at least 16 characters with at least one alphabetical character and at least one special character.
  3. The command for creating the app registration will print the output. You need to note down the value of appId.
  4. Type in the following command az deployment group create --resource-group "shopping-list-bot-workshop-rg" --template-file "<path-to-template-with-preexisting-rg.json>" --parameters appId="<app-id-from-step-3>" appSecret="<password-from-step-2>" botId="<bot-app-service-name>" newWebAppName="<bot-app-service-name>" newAppServicePlanName="<name-of-app-service-plan>" appServicePlanLocation="<region-location-name>" --name "<deployment-name>"
  • Replace shopping-list-bot-workshop-rg with the name of your Azure resource group.
  • Replace <path-to-template-with-preexisting-rg.json> with the path to your local shopping list bot project, ending with shopping-list-bot/deploymentTemplates/template-with-preexisting-rg.json.
  • Replace <app-id-from-step-3> with the appId written down in step 3.
  • Replace <password-from-step-2> with the password you defined in step 2.
  • Replace <bot-app-service-name> with a globally unique name for your bot, for example, workshop-shopping-list-bot-<your-name>.
  • Replace <bot-app-service-name> with a name for the app service, for example, shopping-list-bot-app-service.
  • Replace <name-of-app-service-plan> with a name for the app service plan, for example, shopping-list-bot-app-service-plan.
  • Replace <region-location-name> with an Azure Region where your bot should live, for example, eastus.
  • Replace <deployment-name with a name for this deployment, for example, workshop-shopping-list-bot-deployment.

Now that you have all the resources for the bot up and running in Azure, you will use the continuous delivery pipeline in GitHub Actions to deploy the bot whenever its code changes.

⚠️ **GitHub.com Fallback** ⚠️