botframeworkmicrosoft-teamsazure-bicep

Using Bicep to add an MsTeams channel to an Azure Bot Resource


When attempting to add an MSTeams channel to my deployment I receive a CHANNEL_NOT_SUPPORTED error.

The Bicep I'm using looks something like this.

resource azureBot 'Microsoft.BotService/botServices@2021-03-01' = {
  name: botName
  location: location
  kind: 'azurebot'
  sku: azureBotSku
  properties: {
    displayName: **
    iconUrl: **
    endpoint: **
    msaAppId: **
    msaAppTenantId: ** 
    msaAppMSIResourceId: **
    msaAppType: 'UserAssignedMSI'
    tenantId: tenantId
    luisAppIds: []
    schemaTransformationVersion: '1.3'
    isCmekEnabled: false
  }

  resource teamsChannel 'channels' = {
    name: 'TeamsChannel'
    kind: 'azureBot'
    properties: {
      channelName: 'MsTeamsChannel'
      properties: {
        acceptedTerms: true
        isEnabled: true
      }
    }
  }
}

I can add the channel manually through the portal just fine.


Solution

  • Could you please try with the below snippet?

    https://github.com/OfficeDev/teams-toolkit-samples/blob/dev/bot-sso-docker/infra/botRegistration/azurebot.bicep#L30

    // Connect the bot service to Microsoft Teams

    resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@2021-03-01' = {
      parent: botService
      location: 'global'
      name: 'MsTeamsChannel'
      properties: {
        channelName: 'MsTeamsChannel'
      }
    }