Register a bot with Azure

APPLIES TO: SDK v4

This article shows how to register a bot with the Azure Bot Service when you develop and host it in Azure.

If the bot is hosted elsewhere, you can also make it available in Azure and connect it to the supported channels. You supply the web address where your bot is hosted.

Important

You only need to register a bot if it is not hosted in Azure. Bots created using the Azure portal or the Command Line Interface (CLI) are already registered with the Azure Bot Service. For more information, see Deploy your bot.

Create an Azure Bot resource

The Azure Bot resource enables you to register your Bot Framework Composer or SDK bot in Azure Bot Service. You can build, connect, and manage bots to interact with your users wherever they are, from your app or website to Teams, Messenger and many other channels.

Warning

Web App Bot and Bot Channels Registration will be deprecated but existing resources will continue to work. You should use Azure Bot, instead.

  1. Go to the Azure portal.

  2. In the right pane, select Create a resource.

  3. In the search box enter bot, then press Enter.

  4. Select the Azure Bot card.

    Select Azure bot resource

  5. Select Create.

    Create Azure bot resource

  6. Enter the required values. The following figure shows Create new Microsoft App ID selected.

    Create Azure bot resource values

    You can also select Use existing app registration and enter your existing app Id and password.

    Create Azure bot resource existing values

  7. Select Review + create.

  8. If the validation passes, select Create.

  9. Select Go to resource group. You should see the bot and the related Azure Key Vault resources listed in the resource group you selected.

    Tip

    The app secret (password) is stored in the the key vault and there is one key vault per resource group. Using key vault is recommended instead of copying and storing sensitive data.

  10. Select Open in Composer. This is the recommended path, if you are new to bot development or if you are building a brand new bot. Follow the steps described in the Create a bot in Composer article.

    Create bot in Composer

    Optionally, select Get the SDK from Github to build your bot with the Bot Framework SDK that helps you create everything from a modest chatbot to world class, enterprise solutions.

    Create bot in SDK

About Azure Key Vault

Azure Key Vault is a service that provides centralized secrets management, with full control over access policies and audit history. For more information, see Use Key Vault references for App Service and Azure Functions. Note that you will be charged a small fee for using the service, For more information, see Key Vault pricing.

App Id and password

You need the Azure bot resource app Id and password to configure your bot for deployment. You will assign their values to the related variables: MicrosoftAppId and MicrosoftAppPassword contained in your bot project configuration file. The file differs depending on the programming language you use to create the bot, as shown in the table below.

Language File Name
Csharp appsettings.json
JavaScript .env
Python config.py
Java application.properties

Get Azure bot resource app Id

  1. Go to the Azure portal.
  2. Select the Azure bot resource to obtain its app Id.
  3. In the left pane, in the Settings section, select Configuration.
  4. Copy and save the value contained in the Microsoft App ID box.

Get Azure bot resource password from the Azure key vault

You can access the Azure Key Vault to obtain your resource stored password. Azure Key Vault is a service that provides centralized secrets management, with full control over access policies and audit history. Fpr more information, see Use Key Vault references for App Service and Azure Functions.

Additional information

Manual app registration

A manual registration is necessary for situations like:

  • You are unable to make the registrations in your organization and need another party to create the App ID for the bot you're building.
  • You need to manually create your own app ID and password.

Important

When creating the app, in the section Supports account types, choose one of the following multi-tenant types options:

Type Description
Accounts in any organizational directory (Any Azure AD - Multitenant) This option provides less exposure by restricting access and in case OAuth is not supported.
Accounts in any organizational directory (Any Azure AD - Multitenant) and personal Microsoft accounts (for example, Xbox, Outlook.com) This option is well-suited to support OAuth and bot authentication.

For more information, see Register an application with the Microsoft identity platform.

Update the bot

Set the following key values in the appsettings.json file:

  • MicrosoftAppId = <appId>
  • MicrosoftAppPassword = <appSecret>

Next steps