Kylie Bot Part 9 - World, meet Kylie
The time has finally come to publish Kylie Bot out into the world. This post will focus on publishing the Kylie Bot project to an Azure App Service and then being able to access it through the Web Chat channel. To get started though, we need to register our Kylie Bot app in our bot directory. Do this by navigating here. You should see a screen like this:
You will need to sign in with a set of Microsoft credentials and you can do this by clicking on the 'Sign In' option in the top right hand side of the screen. You should then see this screen:
After entering in your account name and clicking on the 'Next' button, you should then be prompted for a password as follows:
You can then enter in your password and click on 'Sign in' which should result in the following:
Click on 'Create a bot' in the top right hand corner to begin the Bot registration process. It should start off like this:
Complete the Display Name, Bot handle and Long Description fields similarly to the above and then scroll down to where you can set up some configurations on a screen like this:
Next, click on the 'Create Microsoft App ID and password' button which should present you with a screen like this:
The details will be populated for you and popup should show like this:
*Make a note of the App ID and Password and we will use these shortly.
Click on the 'OK' button and then you can complete the dialog by clicking on the 'Finish and go back to Bot Framework' button. Here you will need to scroll down to where you can accept the terms and conditions by checking the checkbox like this:
Clicking on the 'Register' button will complete the process as follows:
Click on 'Confirm' to close the dialog. You will then be returned to the bot's landing page like this:
Next, you will need to update the settings in your web.config file from the bot you just registered. Navigate to the web.config file in your KylieBot project like this:
You can update the ActiveDirectory.ClientId and ActiveDirectory.ClientSecret fields with the values that you copied earlier from the Bot registration process.
*Remember that this change will affect trying to debug the project in the emulator. Don't worry though, in a related post, we will learn how to debug remotely.
Next, we will need to publish our KylieBot project to an Azure App Service. To do this, right click on the KylieBot project and select Publish like this:
You should the have the option to establish a publishing profile in a screen like this:
Select the 'Microsoft Azure App Service' block and you should then be presented with this:
Make sure you are logged into a Microsoft account that has an Azure subscription associated with it, else you will need to create a trial subscription like described here. Complete the profile details and then click on the 'Create' button in the bottom right. Your publish should then start and you should see a screen like this:
After a few moments, a web browser should pop up with the published service like this:
Well done, your bot is now published to Azure. Make sure to copy down the link from the web browser as we will need to use this later. Now that we have a web address for our bot, we will need to update the callback endpoint in our Kylie Bot Azure AD app that we created earlier. To do this, navigate back here. You should see a login page like we saw earlier. Enter in the credentials that we have previously used to create our trial Azure subscription with and then complete the password field, after which you should see the following:
Click on the Azure AD linked application we have created previously by clicking on its name. Mine is called 'Kylie Bot'. Next you should see the following:
Enter in the Redirect URL like above but with your specific site where you just published your bot. Next, click on the 'Save' button in the bottom left of the screen. You will also need to update the web.config file in the KylieBot project to reflect the same address. The field you will need to update in the web.config file is called ActiveDirectory.RedirectUrl.
Finally, we will need to update the messaging endpoint of our bot, to link it to the Azure App Service that we just published our bot to. To do this, navigate here and then complete the login credentials as prompted. Once logged in, you should then see a screen like this:
Click on the Bot we have previous registered and you should be presented with a Bot channel screen like this:
Next, select 'Settings' from the menu bar and you should be presented with something like this:
Complete the Configuration section like above but substitute the address of your Azure App Service app that you published previously. To check if its working correctly, save the changes at the bottom of the screen, by click on the 'Save changes' button and once the page has reloaded, click on the blue 'Test' button in the top right of the screen and you should observe the following:
Awesome stuff, we now have a published bot! Lookout for the next post where we will add the bot to a Dynamics 365 Customer Engagement portal so that users can access it.