Activate Genbots On Teams
Python utility to relay messages to and from an Azure Bot (for MS Teams) to a Genesis instance running in SPCS or any other host on www
Setting Up Azure Bot for MS Teams
Prerequisites
-
Sign up for an Azure account. The free tier is sufficient to set up a bot and adapter
-
Sign up for an M365 developer account. This is required to deploy a bot to Teams.
-
Make sure the Azure command line interface (CLI) is installed on your local device. Run ‘az —version’ on your command line to verify
-
Log in using ‘az login’ and follow the prompts.
-
Make sure your Azure account is connected to at least one subscription. Set the subscription id using az cli or UI. For az cli:
az account set --subscription "<subscription_name_or_id>"
Create Azure Resources
-
Create a resource group on Azure using az cli or UI:
az group create --name <your_resource_group_name> --location <your_location>
-
To get a list of regions:
az account list-locations -o table
-
Verify resource group creation:
az group show --name <your_resource_group_name>
-
Create a bot on Azure:
- In Azure UI, search for ‘Azure Bot’. Choose Marketplace -> Azure Bot
- Add a Bot Handle
- Select your subscription
- Select your resource group
- Select your pricing tier. Free tier is ok
- Choose ‘Multi-tenant’ as Type of App
- Creation type: Create new Microsoft App ID
Setup and Deploy the Adapter
-
Download folder msft_teams_adapter from the Genesis Samples Golden folder
-
Add a private key file with your own RSA private key
-
Update the required values in the envTemplate file with your own information including the name of the private key file from the previous step. Copy the file and rename to .env. This file is excluded in .gitignore.
-
Zip the files and name the archive bot.zip
zip -r bot.zip app.py bot.py requirements.txt .env <your_key_file_path>
Deploy to Azure Web App
Use the following Azure CLI commands to setup and deploy an Azure Web App:
Monitoring Your Bot
You can ‘tail’ the logs from the deployed container on the command line. You can also view the logs on the Azure UI by navigating to Web Apps -> Log Stream:
az webapp log tail --name "<your_app_name>" --resource-group "<your_resource_group_name>"