In our previous article,
Develop Bot For MS Teams With Bot Builder V4 SDK, we developed an Echo Bot with Bot Builder v4 utilizing ngrok to develop and test locally. ngrok is used during the development phase. It allows us to build and test the bot without publishing the app on MS Azure (or other hosting environments).
In this article, we will publish our app (Bot) to MS Azure and channelize to MS Teams.
Publish Bot to Azure
Follow the below steps to publish the Bot application to MS Azure App Service.
- Open the Bot application (i.e. office-content-management) in Visual Studio.
- Open “\office-content-management\Manifest\manifest.json”
- Update the package name as a generic name representing Bot.
Update websiteUrl, privacyUrl, and termsOfUseUrl as an organization URL.
- {
- "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.3/MicrosoftTeams.schema.json",
- "manifestVersion": "1.3",
- "version": "1.0.0",
- "id": "619674bb-c724-4fa0-b42d-22787d35f569",
- "packageName": "com.contoso.contentmanagement",
- "developer": {
- "name": "Office Developer",
- "websiteUrl": "https://www.microsoft.com",
- "privacyUrl": "https://www.microsoft.com/privacy",
- "termsOfUseUrl": "https://www.microsoft.com/termsofuse"
- },
- "icons": {
- "color": "bot-icon-color-192x192.png",
- "outline": "bot-icon-outline-32x32.png"
- },
- "name": {
- "short": "office-content-management-bot ",
- "full": "Office Content Management Bot"
- },
- "description": {
- "short": "Office Content Management",
- "full": "Sample bot for the Office Content Management"
- },
- "accentColor": "#AB00B0",
- "bots": [
- {
- "botId": "619674bb-c724-4fa0-b42d-22787d35f569",
- "supportsFiles": true,
- "scopes": [
- "personal",
- "team"
- ]
- }
- ],
- "composeExtensions": [],
- "permissions": [
- "identity",
- "messageTeamMembers"
- ],
- "validDomains": []
- }
Click the "Build" menu, select “Publish office-content-management”.
- Pick a publish target as “App Service”.
- Select to create a new App Service.
- Click “Advanced…”.
- Set Configuration to Release.
- Under “File Publish Options”, select option “Remove additional files at destination” to remove outdated files during deployment.
- Click "Save" to close the Advanced dialog.
- Click "Publish" on the main screen.
- In the “Create App Service” dialog, specify the needed information.
- Click "Create".
- The Bot application will be deployed to MS Azure App Service.
- Post successful deployment, the app service URL will open in a browser.
Update Manifest
Follow the below steps to update the manifest with App service details.
- In Visual Studio, open “\office-content-management\Manifest\manifest.json”.
- Set websiteUrl, privacyUrl, and termsOfUseUrl to the app service URL.
- Build the solution. The AfterBuild target will run and compressed .zip file will be available under the bin folder.
- Upload app into Microsoft Teams. (Follow instruction from previous article, section Upload app into Microsoft Teams).
From Azure portal, open the Bot Channels Registration, under settings, set the messaging endpoint as app service URL.
Test the Bot in MS Teams