Tutorial: Create a QnA Bot with Azure Bot Service v3

This tutorial walks you through building a QnA bot with Azure Bot service v3 in the Azure portal without writing any code. Connecting a published knowledge base (KB) to a bot is as simple as changing bot application settings.


This topic is for version 3 of the Bot SDK. You can find version 4 here.

In this tutorial, you learn how to:

  • Create an Azure Bot Service with the QnA Maker template
  • Chat with the bot to verify the code is working
  • Connect your published KB to the bot
  • Test the bot with a question

For this article, you can use the free QnA Maker service.


You need to have a published knowledge base for this tutorial. If you do not have one, follow the steps in Create a knowledge base to create a QnA Maker service with questions and answers.

Create a QnA Bot

  1. In the Azure portal, select Create a resource.

    bot service creation

  2. In the search box, search for Web App Bot.

    bot service selection

  3. In Bot Service, provide the required information:

    • Set App name to your bot’s name. The name is used as the subdomain when your bot is deployed to the cloud (for example, mynotesbot.azurewebsites.net).
    • Select the subscription, resource group, App service plan, and location.
  4. To use the v3 templates, select SDK version of SDK v3 and SDK language of C# or Node.js.

    bot sdk settings

  5. Select the Question and Answer template for the Bot template field, then save the template settings by selecting Select.

    save bot service template selection

  6. Review your settings, then select Create. This creates and deploys the bot service with to Azure.

    create bot

  7. Confirm that the bot service has been deployed.

    • Select Notifications (the bell icon that is located along the top edge of the Azure portal). The notification will change from Deployment started to Deployment succeeded.
    • After the notification changes to Deployment succeeded, select Go to resource on that notification.

Chat with the Bot

Selecting Go to resource takes you to the bot's resource.

Select Test in Web Chat to open the Web Chat pane. Type "hi" in Web Chat.

QnA bot web chat

The bot responds with "Please set QnAKnowledgebaseId and QnASubscriptionKey in App Settings. This response confirms that your QnA Bot has received the message, but there is no QnA Maker knowledge base associated with it yet.

Connect your QnA Maker knowledge base to the bot

  1. Open Application Settings and edit the QnAKnowledgebaseId, QnAAuthKey, and the QnAEndpointHostName fields to contain the values of your QnA Maker knowledge base.

    app settings

  2. Get your knowledge base ID, host url, and the endpoint key from the settings tab of your knowledge base in the QnA Maker portal.

    • Sign in to QnA Maker
    • Go to your knowledge base
    • Select the Settings tab
    • Publish your knowledge base, if not already done so

      QnA Maker values

Test the bot

In the Azure portal, select Test in Web Chat to test the bot.

QnA Maker bot

Your QnA Bot answers from your knowledge base.

Clean up resources

When you are done with this tutorial's bot, remove the bot in the Azure portal. The bot services include:

  • The App Service plan
  • The Search service
  • The Cognitive service
  • The App service
  • Optionally, it may also include the application insights service and storage for the application insights data

Next steps

See also