1. Packages
  2. Azure Classic
  3. How-to Guides
  4. Azure Bot Service with Application Insights

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

Azure Bot Service with Application Insights

azure logo

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

    View Code Deploy this example with Pulumi

    Starting point for building Azure Bot Service hosted in Azure App Service.

    Provisions Azure Bot Service, Azure Bot Channel registration and Azure Application Insights to be used in combination with App Service - registering Azure AD Microsoft Application with secret.

    This will deploy the echo bot code within the ~/bot directory - you can tweak the contents or replace the contents with your own bot. Please ensure you publish the bot first to the ~/bot/publish subfolder - following the instructions for Publish Bot Steps.

    Deploying the App

    To deploy your infrastructure, follow the below steps.

    Prerequisites

    Publish Bot Steps

    1. Within the /bot subfolder, publish the bot to subfolder called publish:

      $ dotnet publish -o publish
      

    Pulumi Steps

    1. Within the azure-cs-botservice folder, create a new stack:

      $ pulumi stack init dev
      
    2. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

      $ az login
      
    3. Configure the location to deploy the resources to:

      $ pulumi config set azure:location "North Europe"
      
    4. Configure the Bot Name:

      $ pulumi config set botName PulumiBot1
      
    5. Run pulumi up to preview and deploy changes:

      $ pulumi up
      Previewing changes:
      ...
      
      Performing changes:
      ...
      info: 14 changes performed:
          + 14 resources created
      Update duration: 1m22s
      
    6. Check the deployed bot using either:

    • Azure Portal Azure Bot Service - Test in Webchat feature

    • Bot Framework Emulator pointing to the output bot endpoint and Microsoft Application Id and the secret you supplied:

      $ BotEndpoint: "https://app8asdf.azurewebsites.net/api/messages"
      $ MicrosoftAppId: "b5e65403-923c-4568-z2f6-a6f41b258azz"
      $ MicrosoftAppPassword: "<secret>"
      
    1. Once you’ve finished, you can tear down your stack’s resources by destroying and removing it:

      $ pulumi destroy -y
      $ pulumi stack rm -y
      
    azure logo

    We recommend using Azure Native.

    Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi