Skip to main content

teams app bot migrate

Migrate bot to Azure

Usage​

teams app bot migrate [appId] [options]

Arguments​

ArgumentDescriptionRequired
appIdApp IDNo

Options​

FlagDescription
--subscription <id>[OPTIONAL] Azure subscription ID
--resource-group <name>Azure resource group (required)
--create-resource-group[OPTIONAL] Create the resource group if it doesn't exist
--region <name>[OPTIONAL] Azure region for resource group (default: westus2)
--json[OPTIONAL] Output as JSON

Details​

Migrates a Teams-managed bot to Azure Bot Service. This is needed when you want to use features that require Azure, such as OAuth connections or SSO.

What Happens​

  1. Validation — confirms the bot is not already in Azure and checks prerequisites
  2. Dry run — runs an ARM deployment with --what-if to validate before making changes
  3. Delete old registration — removes the Teams-managed registration
  4. Create Azure Bot — deploys an Azure Bot resource in your resource group
  5. Rollback — if step 4 fails, automatically restores the original registration

What Stays the Same​

  • AAD app registration (same CLIENT_ID)
  • Client secrets (same CLIENT_SECRET)
  • Tenant ID (same TENANT_ID)
  • The bot ID used in the Teams manifest

What Needs Reconfiguration​

After migration, you may need to manually reconfigure:

  • M365 Extensions channel — must be re-enabled in Azure Portal
  • Calling endpoint — must be set again if previously configured

Examples​

teams app bot migrate <appId> --resource-group my-rg

Create the resource group if it doesn't exist:

teams app bot migrate <appId> --resource-group my-rg --create-resource-group --region eastus

Prerequisites​

  • Azure CLI (az) installed and logged in
  • An Azure subscription
  • Bot must not already be in Azure (check with teams app bot get)

See Bot Locations for more on why and when to migrate.