Whitelisting the Microsoft Teams Bot App

Whitelisting the Microsoft Teams Bot App

In order to complete the steps below, you must have Global Administrator role.

The same Bot can be whitelisted in multiple Microsoft Entra (formerly Azure AD) tenants, and can be used for multiple compliance policies.

The registration consists of the following steps:

Prerequisites

  1. Download and install PowerShell 5.1.

  2. Open PowerShell as an administrator.

  3. Set the security protocol to TLS 1.2 with the following command:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  1. Install the NuGet package provider module by running the following command:

    Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
  2. Install the Microsoft Teams module by running the following command:

    Install-Module MicrosoftTeams

Accessing the tenant using PowerShell

Separate Azure tenants for the recording provider (bot) and for the Teams environment to record

In the case when the recorded Teams environment and the recording bot are in separate Microsoft Entra tenants, the following steps have to be done in the Teams tenant.

  1. Open PowerShell as an administrator.

  2. Update the Teams module by running the following command:

    Update-Module MicrosoftTeams
  3. Connect to the Teams tenant by running the following command:

    Connect-MicrosoftTeams
  4. Provide the user credentials in the login prompt that appears.

Registering the bot as a Teams application

  1. Following the login in Step 4 of Accessing the tenant using PowerShell, execute the following command. Provide a unique UPN for the recording bot as the <UPN> value, for example, verbabot@contoso.com. Provide a name as the <displayName> value. Replace the <botAppId> value with the application ID from the previous section (See Creating a Microsoft Teams Compliance Policy ).

    New-CsOnlineApplicationInstance -UserPrincipalname <UPN> -DisplayName '<displayName>' -ApplicationId <botAppId>

In the command results, note down the ObjectId, as it is needed for further configuration.

  1. Execute the following command. Replace the <ObjectId> value with the ObjectID specified by the result of the previous command.

    1. For Microsoft Teams PowerShell versions older than 6.0.0, execute the following command:

      Sync-CsOnlineApplicationInstance -ObjectId <ObjectId>
    2. For Microsoft Teams PowerShell versions 6.0.0 and newer, execute the following command:

      Sync-CsOnlineApplicationInstance -ObjectId <ObjectId> -ApplicationId <botAppId>
  2. (Optional) If 2N recording is being configured, then repeat steps 1-3 for the second bot registration, using the new ObjectId in the commands.