teams app bot migrate
Migrate bot to Azure
Usage​
teams app bot migrate [appId] [options]
Arguments​
| Argument | Description | Required |
|---|---|---|
appId | App ID | No |
Options​
| Flag | Description |
|---|---|
--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​
- Validation — confirms the bot is not already in Azure and checks prerequisites
- Dry run — runs an ARM deployment with
--what-ifto validate before making changes - Delete old registration — removes the Teams-managed registration
- Create Azure Bot — deploys an Azure Bot resource in your resource group
- 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.