Connect your bot to channels with Azure CLI

A channel is a connection between a communication application and a bot. A bot, registered with Azure, uses channels to enable communication with users. The commands in this article connect a bot to various channels. For more information, see Connect a bot to channels.

Prerequisites

  • If you prefer to run CLI reference commands locally, install the Azure CLI. If you're running on Windows or macOS, consider running Azure CLI in a Docker container. For more information, see How to run the Azure CLI in a Docker container.

    • If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For other sign-in options, see Sign in with the Azure CLI.

    • When you're prompted, install the Azure CLI extension on first use. For more information about extensions, see Use extensions with the Azure CLI.

    • Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.

Sample commands

The following sections use Azure CLI commands to connect a bot to a channel. These examples use a bot named ContosoBot in the ContosoBotRG resource group.

Some of these channels require the command to connect with the application to authenticate. If you're running these commands for testing purposes, they can fail if you don't use real values.

Direct Line

Direct Line integrates your bot into a mobile app, web page, or other applications. For more information, see About Direct Line.

These sample commands create a connection to the Direct Line channel by using az bot directline create. The example shows the connection in the console and deletes the connection.

az bot directline create --resource-group ContosoBotRG --name ContosoBot --disablev1
az bot directline show --resource-group ContosoBotRG --name ContosoBot
az bot directline delete --resource-group ContosoBotRG --name ContosoBot

Microsoft Teams

You can configure your bot to communicate with Microsoft Teams. For more information, see Connect a bot to Microsoft Teams.

These sample commands create a connection to the channel for Microsoft Teams by using az bot msteams create. The example shows the connection in the console and deletes the connection.

az bot msteams create --resource-group ContosoBotRG --name ContosoBot --calling-web-hook https://www.contosoapp.com/ \
   --enable-calling 
az bot msteams show --resource-group ContosoBotRG --name ContosoBot 
az bot msteams delete --resource-group ContosoBotRG --name ContosoBot

Clean up deployment

If you created a resource group for testing, run the az group delete command to remove the resource group and everything it contains.

az group delete --name ContosoBotRG

To remove a connection to a channel, use the appropriate delete command.

Azure CLI commands used in this article

This article uses the following Azure CLI commands:

Next steps