When you build a bot with Visual Studio, you can take advantage of its built-in publishing capability. This tutorial shows you how to deploy a .NET bot to Azure directly from Visual Studio 2017.
If you created a bot with the Azure Bot Service, your bot deployment was part of the Azure Bot Service bot creation process. For more information, see Publish a bot to Azure Bot Service.
- You must have a Microsoft Azure subscription. If you do not already have a subscription, you can register for a free trial.
- Install Visual Studio 2017. If you do not already have Visual Studio, you can download Visual Studio 2017 Community for free.
- Install Azure development. You can choose to have Azure development installed while installing Visual Studio or you can add it if you already have Visual Studio installed. You can add it by going to your computer's Uninstall or change a program, find Microsoft Visual Studio 2017 and choose to Modify it. When the Workloads window shows up, check the box for Azure development and click Modify to install this resource.
Application settings and Messaging endpoint
Verify application settings
For your bot to function properly in the cloud, you must ensure that its application settings are correct. If you've already registered your bot with the Bot Framework, update the Microsoft App Id and Microsoft App Password values in your application's configuration settings as part of the deployment process. Specify the app ID and password values that were generated for your bot during registration.
If you're using the Bot Builder SDK for Node.js, set the following environment variables:
If you're using the Bot Builder SDK for .NET, set the following key values in the web.config file:
If you have not yet registered your bot with the Bot Framework (and therefore do not yet have an app ID and password), you can deploy your bot with temporary placeholder values for these settings. Then later, after you register your bot, update your deployed application's settings with the app ID and password values that were generated for your bot during registration.
Verify Messaging endpoint
Your deployed bot must have an Messaging endpoint that can receive messages from the Bot Framework Connector Service.
When you deploy your bot to Azure, SSL will automatically be configured for your application, thereby enabling the Messaging endpoint that the Bot Framework requires. If you deploy to another cloud service, be sure to verify that your application is configured for SSL so that the bot will have a Messaging endpoint.
Step 1: Launch the Microsoft Azure Publishing Wizard in Visual Studio
Open your .NET bot project in Visual Studio. In Solution Explorer, right-click on the project name and select Publish. This starts the Microsoft Azure publishing wizard.
Step 2: Publish to Azure using the Azure Publishing Wizard
Select Microsoft Azure App Service as the project type and click Publish.
Click Change Type and change the service's type to Web App. Then, name your web app and fill out the rest of the information as appropriate for your implementation.
Click Create to create your app service. Once the service is created, the bot will be published to Azure and your bot's HTML page will be displayed in your default browser.
Copy the Site URL value to the clipboard. You will need this value later to test the connection to the bot using the Emulator.
By default, your bot will be published in a Release configuration. If you want to debug your bot, in Settings, change Configuration to Debug.
Click Save to save your settings.
Step 3: Test the connection to your bot
Verify the deployment of your bot by using the Bot Framework Emulator.
Enter the bot's Messaging endpoint into the address bar of the Emulator. If you built your bot with the Bot Builder SDK, the endpoint should end with /api/messages.
After you have deployed your bot to the cloud and verified that the deployment was successful by testing the bot using the Bot Framework Emulator, the next step in the bot publication process will depend upon whether or not you've already registered your bot with the Bot Framework.
If you have already registered your bot with the Bot Framework:
If you have not yet registered your bot with the Bot Framework:
Update the Microsoft App Id and Microsoft App Password values in your deployed application's configuration settings to specify the app ID and password values that were generated for your bot during the registration process.