-
Notifications
You must be signed in to change notification settings - Fork 192
Upgrade project to use Teams Toolkit 5.0 features
Teams Toolkit continuously evolves to offer more powerful features for developers. Teams Toolkit 5.0 provides following new features to help you better build your existing Teams app project using Teams Toolkit:
- Use an existing Teams app ID
- Use an existing Microsoft Entra app registration ID
- Use a different tunneling solution or customize the defaults
- Use existing infrastructure, resource groups, and more when provisioning
- Add custom steps to debugging, provisioning, deploying, publishing, etc.
These new features will require an update to your existing project structure. Teams Toolkit can automatically upgrade your project with your consent.
A: No. The upgrade only changes the files used by Teams Toolkit. You can refer File Structure Change to learn more about the possible changes.
A: Yes. The upgrade will backup changed files in your project. You can refer How to roll back to roll back the changes.
A: If you do not want to upgrade temporary, you can use VS Code Teams Toolkit 4.X / TeamsFx CLI 1.X / Visual Studio 2022 17.4 to develop your projects.
A: There are a few known issues that we've provided solutions below. If the issue continue to exist, feel free to reach us at [email protected].
Teams Toolkit can automatically upgrade your project with your consent. To trigger upgrade, you can:
- Open your project using VS Code or VS, click upgrade in VS Code's upgrade notification or VS's upgrade info bar.
- Trigger any Teams Toolkit command in VS Code, VS or Teams Toolkit CLI, Teams Toolkit will ask you to confirm upgrade.
You need to trigger the expected command again after upgrade.
- Open VS Code command palette (Shift + Command + P (Mac) / Ctrl + Shift + P (Windows/Linux)) and run
Teams: Upgrade project
command. - Click Teams Toolkit sidebar in VS Code, and click
Upgrade project
button.
We recommend using git to track changes during upgrade.
Teams Toolkit performs the following changes to your project during upgrade.
- Created
teamsapp.yml
andteamsapp.local.yml
in your project's root folderThese file contains lifecycle configuration for your project
- Moved environment files in
.fx
to.env.{env}
inenv
folderThe environment files in old project contains
state.{env}.json
,config.{env}.json
- If your project contains file
.fx/states/{env}.userdata
, the content will be moved to.env.{env}.user
inenv
folder - Moved
templates/appPackage
toappPackage
and updated placeholders in it per latest tooling's requirement.This step also renamed
appPackage/manifest.template.json
toappPackage/manifest.json
The tooling now uses${{ENV_VAR_NAME}}
to reference environment variables and all old placeholders have been renamed to environment variable - If your project contains
templates/appPackage/aad.template.json
, moved it toaad.manifest.json
and updated placeholders in it per latest tooling's requirement.The tooling now uses
${{ENV_VAR_NAME}}
to reference environment variables and all old placeholders have been renamed to environment variable - If your project contains file
.vscode/tasks.json
and.vscode/launch.json
, they will be updated. - Updated
.gitignore
to ignore new environment files. - Removed
.fx
folderContent under this folder is no longer used.
All existing files will be moved into
.backup
folder for your reference. You can safely delete the.backup
folder after you reviewed the changes.
If you still want to restore your project configuration after the upgrade is successful and continue to use old version Teams Toolkit, you can:
- Copy every folder / file under
.backup
folder to your project root pathYou can safely overwrite any existing files if you didn't change the files after upgrade.
- Remove the new folders / files mentioned in File Changes section:
- teamsapp.yml and teamsapp.local.yml
- aad.manifest.json
- env folder
- appPackage folder
If your project only contains a bot, an error might occur saying STATE__FX_RESOURCE_FRONTEND_HOSTING__ENDPOINT
is missing when executing commands. Provide a valid URL for the property that uses this placeholder in appPackage/manifest.json
to fix it. Here's an example:
"developer": {
"name": "Teams App, Inc.",
"websiteUrl": "https://example.com",
"privacyUrl": "https://example.com/privacy",
"termsOfUseUrl": "https://example.com/termsofuse"
}
This happens in projects created using VS Code Teams Toolkit 4.0.1 or earlier version. The old tooling provides a default example URL for your project if this placeholder does not exist. In latest tooling, we want to make everything more transparent so requires you to provide your URL here.
You may be trying to upgrade a project created by Teams Toolkit for Visual Studio Code v3.x / Teams Toolkit CLI v0.x / Teams Toolkit for Visual Studio v17.3. Please install Teams Toolkit for Visual Studio Code v4.x / Teams Toolkit CLI v1.x / Teams Toolkit for Visual Studio v17.4 and run upgrade first.
If your tab app is created with Teams Toolkit 3.2.0 or earlier version, you may see error simpleAuthEndpoint in configuration is invalid
when remote debugging your app.
To fix this: Open teamsapp.yml
, find the npm build command in deploy lifecycle and add an additional env REACT_APP_TEAMSFX_ENDPOINT
as below:
- uses: cli/runNpmCommand
env:
REACT_APP_CLIENT_ID: ${{AAD_APP_CLIENT_ID}}
REACT_APP_START_LOGIN_PAGE_URL: ${{PROVISIONOUTPUT__FRONTENDHOSTINGOUTPUT__ENDPOINT}}/auth-start.html
REACT_APP_TEAMSFX_ENDPOINT: ${{PROVISIONOUTPUT__SIMPLEAUTHOUTPUT__ENDPOINT}}
with:
workingDirectory: tabs
args: run build --if-present
Since simple auth is deprecated, refer to wiki for best practices and iterate your application to use the latest TeamsFx SDK.
If your project failed to provision or publish by teamsApp/validateAppPackage
action after upgrade but had provisioned successfully before, please use the validation to check your appPackage zip file and fix the error.
If you find some files are missing under appPackage
folder after upgrade, you can find them in the .backup/templates/appPackage
. Please copy these files (exclude manifest.template.json
, aad.manifest.json
and resources
since they have been handled already) to appPackage folder manually.
If you've encountered the error message "Teams Toolkit now uses Dev Tunnel as default tunnel solution. For manual updates, see https://aka.ms/teamsfx-tasks/local-tunnel.", you'll need to update your Start local tunnel
task to continue using Teams Toolkit. Please follow the instructions in this document to update the task.
If you've customized botMessagingEndpoint
in debug-set-up-bot
task and never debug successfully, please set the PROVISIONOUTPUT_AZUREWEBAPPBOTOUTPUT_DOMAIN
in env/.env.local
with the domain of your botMessagingEndpoint
after migrated to Teams Toolkit V5.
If you've encountered error "TeamsFxCLI.CannotDetectRunCommand: Cannot detect run command by project type" when executing preview command via TeamsFx CLI 2.x. Please add parameter "--run-command" to the preview command, e.g.
teamsfx preview --env local --run-command "cd tabs && npm run dev:teamsfx"
or teamsfx preview --env local --run-command "cd bot && npm run dev:teamsfx"
(Depends on your project folder structure)
There're some changes to existing features you should be aware of:
- All the user environment files
.env.{env_name}.user
will be gitignored by default. You need to sync the environment variables in.env.{env_name}.user
files underenv
folder by yourselves to other machines to operate corresponding environments. - When creating new environments(call
Creating New Environment
in command palette in VS Code), you need to fill customized fields in the new.env.{env_name}
file. Usually you need to provide values for all environment values withCONFIG__
prefix. - When creating new secret environments, you need to fill customized fields in the new
.env.{env_name}.user
file. Usually you need to provide values for all environment values withCONFIG__
prefix. - When creating new environments, you need to manually create
templates/azure/azure.parameters.{env_name}.json
as Azure provision parameters and fill the parameter values accordingly. - Some additional steps are required if you added SQL or APIM to your project. Refer Provision SQL databases and Provision APIM service section to learn more.
- When launching your app for a remote environment in VS Code, Teams Toolkit will no longer ask you to select an environment. You need to manually change environment name for
${dev:teamsAppId}
in.vscode/launch.json
to launch your app for a certain environment.
If you didn't use Teams Toolkit to add SQL databases to your project, these changes won't impact your project.
- When you provision a new environment, you need to provide values for
STATE__FX_RESOURCE_AZURE_SQL__ADMIN
andSECRET_FX_RESOURCE_AZURE_SQL__ADMINPASSWORD
in.env.{env_name}.user
which are required inputs for creating SQL databases.If you're provisioning an existing environment, you don't need this step.
- You need to grant permission to user assigned identity manually after provisioning a new environment. Here're the steps:
-
Go to
env/.env.{envName}
and find SQL Server resource id. The resource id usually saved inPROVISIONOUTPUT__AZURESQLOUTPUT__SQLRESOURCEID
environment variable and has this pattern:/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Sql/servers/{sql_server_name}
. Record the resource group name and SQL Server name, they will be used later. -
Go to
env/.env.{envName}
and find SQL Server database name. The database name usually saved inPROVISIONOUTPUT__AZURESQLOUTPUT__DATABASENAME
environment variable. -
Go to
env/.env.{envName}
and find User Assigned Identity resource id. The resource id usually saved inPROVISIONOUTPUT__IDENTITYOUTPUT__IDENTITYRESOURCEID
environment variable and has this pattern/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{user_assigned_identity_name}
. Record the User Assigned Identity name, it will be used later. -
Configure Microsoft Entra admin in SQL Database. You can follow set Microsoft Entra admin to set Microsoft Entra admin for the SQL Server found in step i. Usually you can use the account logged-in Azure as Microsoft Entra admin.
-
Go to your SQL Database found in step ii, login using the Microsoft Entra admin
-
Create contained database users. Replace
{user_assigned_identity_name}
with the value from step iii in following Transact-SQL and execute:CREATE USER [{user_assigned_identity_name}] FROM EXTERNAL PROVIDER; go sp_addrolemember 'db_datareader', '{user_assigned_identity_name}'; go sp_addrolemember 'db_datawriter', '{user_assigned_identity_name}'; go
-
If there are multiple databased in your project, add User Assigned Identity to all of them.
-
If you didn't use Teams Toolkit to add API Management service to your project, these changes won't impact your project.
- When you provision an environment, you need to provide values for
APIM__PUBLISHEREMAIL
andAPIM__PUBLISHERNAME
in.env.{env_name}
which are required inputs for creating or updating APIM services. - You need to manually create an Microsoft Entra app for APIM service when provisioning a new environment. This document includes tutorials about how to create an Microsoft Entra app for APIM service.
- Teams Toolkit no longer support deploy API spec to APIM any more.
Teams Toolkit will reuse your provisioned resource when upgrading (except Bot Service), when you wish to add a new environment after project upgrading, please remember to change resource name in
azure.parameters.{your_env_name}.json
to avoid name conflicts.
The Teams Toolkit now uses Dev Tunnel as its default tunnel solution. If you have customized the Start local tunnel task in your .vscode/tasks.json
file, you will need to manually update it. Here are the steps to follow:
- Refer to this document to learn how to use Teams Toolkit dev tunnel service.
- If you prefer to use ngrok instead, you can still do so by following this document to set up. By updating your local tunnel service, you can continue to use Teams Toolkit seamlessly and customize it according to your preferences.
This section helps you understand how to upgrade the old project template (created by Teams Toolkit 4.X) to latest structure. If you have customized the project after creation, you can make additional changes during the upgrade steps for your customized part.
In general, the upgrade process contains 2 steps:
-
Create a new project using latest Teams Toolkit and copy your source code to it
Refer Step 1: create a new project and copy your source code to it for detailed steps
-
Transform the placeholders used by old Teams Toolkit to new format
Refer Step 2: transform the placeholders to new format for detailed steps
Based on the Teams capabilities in your project, choose the guide that suitable to your project:
- If your project only contains 1 capability (tab, bot or message extension), follow the steps in Project with single Teams capability that hosted on Azure
- If your project contains multiple capabilities (tab, bot, message extension) or contains a backend api, follow the steps in Project with multiple Teams capability that hosted on Azure
- If your project is a SPFx tab, follow the steps in SPFx tab project
The steps in this section is prepared for project that contains only 1 capability (tab, bot or message extension).
-
Trigger "Teams: Create a new app" command using Teams Toolkit 5.0.0 to create a new project with same capability or same scenario as your current project.
-
Remove source code in the new project and copy your current project's source code to the new project
-
If your project is a tab app, copy everything under
tab
folder to the new project's root folder -
If your project is a bot app or message extension app, copy everything under
bot
folder to the new project's root folder
-
-
Find project id under
.fx/configs/projectSettings.json
, put the value to the new project'steamsapp.yml
'sprojectId
property -
Copy your ARM template to the new project
-
Remove everything under the new project's
infra
folder. -
Copy everything under
templates/azure
in your current project to the new project'sinfra
folder. -
Rename
main.bicep
toazure.bicep
. -
Copy
.fx/configs/azure.parameters.{env}.json
to the new project'sinfra
folder. -
Update the new project's
teamsapp.yml
file, changeparameters: ./infra/azure.parameters.json
toparameters: ./infra/azure.parameters.${{TEAMSFX_ENV}}.json
-
-
Copy your Teams manifest to the new project
-
Remove everything under the new project's
appPackage
folder -
Copy everything except
aad.template.json
(if have) under your existing project'stemplates/appPackage
folder toappPackage
in your new project -
Rename
appPackage/manifest.template.json
toappPackage/manifest.json
.
-
-
If your existing project contains
templates/appPackage/aad.template.json
, copy the content of this file toaad.manifest.json
(under root of the project folder) in your new project. -
Refer Step 2: transform the placeholders to new format to update placeholders in
appPackage/manifest.json
,aad.manifest.json
(if have) andinfra/azure.parameters.{env}.json
.
The steps in this section is prepared for project that contains multiple 1 capabilities (tab, bot or message extension), or contains a backend api.
-
Download sample project based on your project's capabilities
Capabilities Sample project location tab, api, SSO sample project tab, bot / message extension sample project tab, bot / message extension, SSO sample project tab, api, bot / message extension, SSO sample project -
Copy your project's source code to the new project
- If your project contains a tab, copy everything under
tabs
folder to the new project'stabs
folder - If your project contains api, copy everything under
api
folder to the new project'sapi
folder - If your project contains a bot or/and message extension, copy everything under
bot
folder to the new project'sbot
folder
- If your project contains a tab, copy everything under
-
Find project id under
.fx/configs/projectSettings.json
, put the value to the new project'steamsapp.yml
'sprojectId
property -
Copy your ARM template to the new project
-
Create an
infra
folder in the new project and copy everything undertemplates/azure
in your current project to the new project'sinfra
folder. -
Rename
main.bicep
toazure.bicep
. -
Copy
.fx/configs/azure.parameters.{env}.json
to the new project'sinfra
folder.
-
-
Copy your Teams manifest to the new project
-
Create an
appPackage
folder in the new project. -
Copy everything except
aad.template.json
(if have) under your existing project'stemplates/appPackage
folder toappPackage
in your new project -
Rename
appPackage/manifest.template.json
toappPackage/manifest.json
.
-
-
If your existing project contains
templates/appPackage/aad.template.json
, create a new fileaad.manifest.json
under root of the new project and copy the content oftemplates/appPackage/aad.template.json
in your existing project to the new file. -
Refer Step 2: transform the placeholders to new format to update placeholders in
appPackage/manifest.json
,aad.manifest.json
(if have) andinfra/azure.parameters.{env}.json
.
The steps in this section is prepared SPFx tab project.
-
Trigger "Teams: Create a new app" command using Teams Toolkit 5.0.0 to create a new SPFx tab project
-
Copy everything under your project's
SPFx
folder to the new project's root folder -
Find project id under
.fx/configs/projectSettings.json
, put the value to the new project'steamsapp.yml
'sprojectId
property -
Copy your Teams manifest to the new project
-
Copy your existing project's
templates/appPackage/resources
folder toappPackage
in your new project -
Record the values of
contentUrl
andconfigurationUrl
in the new project'sappPackage/manifest.json
file andappPackage/manifest.local.json
file -
Copy content of your existing project's
template/appPackage/manifest.template.json
file to the new project'sappPackage/manifest.json
andappPackage/manifest.local.json
-
Copy the value of
contentUrl
andconfigurationUrl
recorded in step 2 back toappPackage/manifest.json
andappPackage/manifest.local.json
-
-
Refer Step 2: transform the placeholders to new format to update placeholders in
appPackage/manifest.json
,appPackage/manifest.local.json
.
The latest Teams Toolkit can resolve environment variables in your manifest / parameter files, which can be easily integrated with different engineering system. This requires you to update the placeholders in your existing manifest / parameter files.
For every manifest or parameter file, you need to do following things. This is just an overview, you can find more details in Steps to update the old placeholders. If you're not familiar with
-
Add new environment variables to
env/.env.{env}
files. Each environment variable represents an old placeholder in your project.If
.fx/configs/config.{env}.json
or.fx/states/state.{env}.json
contains value for the old placeholder, you also need to copy the value to corresponding environment variable inenv/.env.{env}
files.If
.fx/states/{env}.userdata
contains value for the old placeholder, you also need to copy the value to corresponding environment variable inenv/.env.{env}.user
files. -
Replace the old placeholders
{{xxx}}
and{{{xxx}}}
in your manifest / parameter files with new format${{xxx}}
. The name used in the new placeholder should be same with the environment variable name you added in above step.
-
Replace
{{config.xxx}}
placeholders inappPackage/manifest.json
,aad.manifest.json
andinfra/azure.parameters.{env}.json
files.-
Copy following sample snippet to
env/.env.{env}
.COLOR_ICON=resources/color.png OUTLINE_ICON=resources/outline.png DESCRIPTION_SHORT=Short description of myapp DESCRIPTION_FULL=Full description of myapp APP_NAME_SHORT=myapp APP_NAME_FULL=Full name for myapp
You need to change the values to the actual one for your project. The values can be found in
.fx/configs/config.{env}.json
. You can also change the environment variable names as you want. Your project may not use all the placeholders in the sample, you can delete the unused one. -
Open
manifest.json
,aad.manifest.json
andazure.parameters.{env}.json
, replace every old placeholder in below table to the new one.Old placeholder New placeholder {{config.manifest.icons.color}} ${{COLOR_ICON}} {{config.manifest.icons.outline}} ${{OUTLINE_ICON}} {{config.manifest.appName.short}} ${{DESCRIPTION_SHORT}} {{config.manifest.appName.full}} ${{DESCRIPTION_FULL}} {{config.manifest.description.short}} ${{APP_NAME_SHORT}} {{config.manifest.description.full}} ${{APP_NAME_FULL}} If your project uses additional
{{config.xxx}}
placeholders, you can refer the sample to add additional environment variables.
-
-
Replace
{{{state.fx-resource-aad-app-for-teams.applicationIdUris}}}
placeholder inappPackage/manifest.json
,aad.manifest.json
andinfra/azure.parameters.{env}.json
files.- If you do not use any SSO functionality and your project does not require an Microsoft Entra application, you can remove following redundant things in your project
- Remove
aad.manifest.json
file - Remove
aadApp/create
andaadApp/update
actions inteamsapp.yml
andteamsapp.local.yml
- Remove
webApplicationInfo
property inappPackage/manifest.json
- Remove
- If your project only enables SSO for tab, convert it to
api://{{state.fx-resource-frontend-hosting.domain}}/${{AAD_APP_CLIENT_ID}}
- If your project only enables SSO for bot or message extension, convert it to
api://botid-${{BOT_ID}}
- If your project enables SSO for both and bot / message extension, convert it to
api://{{state.fx-resource-frontend-hosting.domain}}/botid-${{BOT_ID}}
The
{{state.fx-resource-frontend-hosting.domain}}
with be replaced again in later step, don't worry on having this placeholder temporary - If you do not use any SSO functionality and your project does not require an Microsoft Entra application, you can remove following redundant things in your project
-
Replace following placeholders to the new one in
aad.manifest.json
file.Old placeholder New placeholder {{state.fx-resource-aad-app-for-teams.frontendEndpoint}} {{state.fx-resource-frontend-hosting.endpoint}} {{state.fx-resource-aad-app-for-teams.botEndpoint}} {{state.fx-resource-bot.siteEndpoint}} The new placeholder will be replaced again in later step, don't worry on having this placeholder temporary
-
Replace
{{state.xxx}}
placeholders inappPackage/manifest.json
,aad.manifest.json
andinfra/azure.parameters.{env}.json
files.-
Copy following sample snippet to
env/.env.{env}
and update your manifest / parameter files to reference the environment variables in the samples.TEAMS_APP_TENANT_ID=00000000-0000-0000-0000-000000000000 # use ${{TEAMS_APP_TENANT_ID}} to replace the old placeholder {{state.fx-resource-appstudio.tenantId}} TEAMS_APP_ID=00000000-0000-0000-0000-000000000000 # use ${{TEAMS_APP_ID}} to replace the old placeholder {{state.fx-resource-appstudio.teamsAppId}} AAD_APP_CLIENT_ID=00000000-0000-0000-0000-000000000000 # use ${{AAD_APP_CLIENT_ID}} to replace the old placeholder {{state.fx-resource-aad-app-for-teams.clientId}} or {{state.aad-app.clientId}} SECRET_AAD_APP_CLIENT_SECRET=your-aad-app-secret # use ${{SECRET_AAD_APP_CLIENT_SECRET}} to replace the old placeholder {{state.fx-resource-aad-app-for-teams.clientSecret}} or {{state.aad-app.clientSecret}} AAD_APP_OBJECT_ID=00000000-0000-0000-0000-000000000000 # use ${{AAD_APP_OBJECT_ID}} to replace the old placeholder {{state.fx-resource-aad-app-for-teams.objectId}} or {{state.aad-app.objectId}} AAD_APP_ACCESS_AS_USER_PERMISSION_ID=00000000-0000-0000-0000-000000000000 # use ${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}} to replace the old placeholder {{state.fx-resource-aad-app-for-teams.oauth2PermissionScopeId}} or {{state.aad-app.oauth2PermissionScopeId}} AAD_APP_TENANT_ID=00000000-0000-0000-0000-000000000000 # use ${{AAD_APP_TENANT_ID}} to replace the old placeholder {{state.fx-resource-aad-app-for-teams.tenantId}} or {{state.aad-app.tenantId}} AAD_APP_OAUTH_AUTHORITY_HOST=https://login.microsoftonline.com # use ${{AAD_APP_OAUTH_AUTHORITY_HOST}} to replace the old placeholder {{state.fx-resource-aad-app-for-teams.oauthHost}} or {{state.aad-app.oauthHost}} AAD_APP_OAUTH_AUTHORITY=https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000 # use ${{AAD_APP_OAUTH_AUTHORITY}} to replace the old placeholder {{state.fx-resource-aad-app-for-teams.oauthAuthority}} or {{state.aad-app.oauthAuthority}} BOT_ID=00000000-0000-0000-0000-000000000000 # use ${{BOT_ID}} to replace the old placeholder {{state.fx-resource-bot.botId}} or {{state.teams-bot.botId}} SECRET_BOT_PASSWORD=your-Microsoft-Entra-app-secret # use ${{SECRET_BOT_PASSWORD}} to replace the old placeholder {{state.fx-resource-bot.botPassword}} or {{state.teams-bot.botPassword}}
You need to change the values to the actual one for your project. The values can be found in
.fx/states/state.{env}.json
. If there is nostate.{env}.json
file orstate.{env}.json
does not contain a property for the placeholder, leave the environment variable value empty.Value of
SECRET_AAD_APP_CLIENT_SECRET
andSECRET_BOT_PASSWORD
can be found in.fx/states/{env}.userdata
. You can copy the encrypted value to new place directly.You should not change the environment variable names in above sample.
Your project may not use all the placeholders in the sample, you can delete the unused one.
-
Open
appPackage/manifest.json
,aad.manifest.json
andinfra/azure.parameters.{env}.json
, replace every old placeholder in below table to the new one.Old placeholder New placeholder {{state.fx-resource-appstudio.tenantId}} ${{TEAMS_APP_TENANT_ID}} {{state.fx-resource-appstudio.teamsAppId}} ${{TEAMS_APP_ID}} {{state.fx-resource-aad-app-for-teams.clientId}} ${{AAD_APP_CLIENT_ID}} {{state.aad-app.clientId}} ${{AAD_APP_CLIENT_ID}} {{state.fx-resource-aad-app-for-teams.clientSecret}} ${{SECRET_AAD_APP_CLIENT_SECRET}} {{state.aad-app.clientSecret}} ${{SECRET_AAD_APP_CLIENT_SECRET}} {{state.fx-resource-aad-app-for-teams.objectId}} ${{AAD_APP_OBJECT_ID}} {{state.aad-app.objectId}} ${{AAD_APP_OBJECT_ID}} {{state.fx-resource-aad-app-for-teams.oauth2PermissionScopeId}} ${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}} {{state.aad-app.oauth2PermissionScopeId}} ${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}} {{state.fx-resource-aad-app-for-teams.tenantId}} ${{AAD_APP_TENANT_ID}} {{state.aad-app.tenantId}} ${{AAD_APP_TENANT_ID}} {{state.fx-resource-aad-app-for-teams.oauthHost}} ${{AAD_APP_OAUTH_AUTHORITY_HOST}} {{state.aad-app.oauthHost}} ${{AAD_APP_OAUTH_AUTHORITY_HOST}} {{state.fx-resource-aad-app-for-teams.oauthAuthority}} ${{AAD_APP_OAUTH_AUTHORITY}} {{state.aad-app.oauthAuthority}} ${{AAD_APP_OAUTH_AUTHORITY}} {{state.fx-resource-bot.botId}} ${{BOT_ID}} {{state.teams-bot.botId}} ${{BOT_ID}} {{state.fx-resource-bot.botPassword}} ${{SECRET_BOT_PASSWORD}} {{state.teams-bot.botPassword}} ${{SECRET_BOT_PASSWORD}}
-
-
Replace remaining
{{state.xxx}}
placeholders inappPackage/manifest.json
,aad.manifest.json
andinfra/azure.parameters.{env}.json
files. There placeholders are generated during ARM deployment.-
Understand the rule to convert ARM deployment to environment variable names. The rule is: PROVISIONOUTPUT__
{output name in infra/provision.bicep}
__{output property name in infra/provision.bicep}
. For example, if you have following output ininfra/provision.bicep
:output azureStorageTabOutput object = { teamsFxPluginId: 'teams-tab' domain: azureStorageTabProvision.outputs.domain endpoint: azureStorageTabProvision.outputs.endpoint indexPath: azureStorageTabProvision.outputs.indexPath storageResourceId: azureStorageTabProvision.outputs.storageResourceId }
Teams Toolkit will transform them to following environment variables based on the rule:
PROVISIONOUTPUT__AZURESTORAGETABOUTPUT__TEAMSFXPLUGINID= PROVISIONOUTPUT__AZURESTORAGETABOUTPUT__DOMAIN= PROVISIONOUTPUT__AZURESTORAGETABOUTPUT__ENDPOINT= PROVISIONOUTPUT__AZURESTORAGETABOUTPUT__INDEXPATH= PROVISIONOUTPUT__AZURESTORAGETABOUTPUT__STORAGERESOURCEID=
-
Understand how to map
{{state.xxx.xxx}}
to ARM deployment output. The middle part in{{state.xxx.xxx}}
represents theteamsFxPluginId
ininfra/provision.bicep
. For example,{{state.fx-resource-frontend-hosting.endpoint}}
comes from output withteamsFxPluginId=fx-resource-frontend-hosting
. Follow this rule to find outputs ininfra/provision.bicep
for old placeholders and figure out their new environment variable names. Add the new environment variables toenv/.env.{env}
and replace the old placeholders to reference the new environment variables inappPackage/manifest.json
,aad.manifest.json
andinfra/azure.parameters.{env}.json
files.If you don't find plugin ID in
infra/provision.bicep
, map the plugin ID from{{state.xxx.xxx}}
to the new one based on following tableold plugin ID new plugin ID fx-resource-frontend-hosting teams-tab fx-resource-function teams-api fx-resource-bot teams-bot fx-resource-aad-app-for-teams Microsoft-Entra-app For example, the steps to replace placeholder
{{{state.fx-resource-frontend-hosting.endpoint}}}
are: 1. The plugin id for this placeholder isfx-resource-frontend-hosting
. 2. Refer above table, find bicep outputazureStorageTabOutput
that contains plugin idfx-resource-frontend-hosting
orteams-tab
. 3. The environment variable name should bePROVISIONOUTPUT__AZURESTORAGETABOUTPUT__ENDPOINT
4. Replace{{{state.fx-resource-frontend-hosting.endpoint}}}
with{{PROVISIONOUTPUT__AZURESTORAGETABOUTPUT__ENDPOINT}}
-
Open
teamsapp.yml
andteamsapp.local.yml
. For every environment variable reference (in the format of${{ENV_VAR_NAME}}
), if the environment variable name does not equal to any environment variable names you figured out in previous step, update the environment variable names to the one you figured out. Usually only the middle part of the name may be different. This is because the variable names outputted in ARM template may be different in different Teams Toolkit version. The sample uses latest output variable names, which may be different than projects created by an old Teams Toolkit. -
Open
appPackage/manifest.json
andaad.manifest.json
(if have), update any remaining old placeholders to reference the new environment variables you figured out in previous step.Some old placeholders may contain 3 braces (e.g.
{{{state.fx-resource-frontend-hosting.endpoint}}}
), remove all the 3 braces when replacing it with the new placeholder. -
Open
teamsapp.yml
andteamsapp.local.yml
, replace<your-teams-app-name>
,<your-bot-Microsoft-Entra-app-name>
,<your-Microsoft-Entra-app-name>
,<your-bot-registration-name>
with the name you want. -
Find
Start local tunnel
in.vscode/tasks.json
, update the output to outputendpoint
anddomain
to the new environment variables for bot. For example:{ "label": "Start local tunnel", "type": "teamsfx", "command": "debug-start-local-tunnel", "args": { "type": "dev-tunnel", "ports": [ { "portNumber": 3978, "protocol": "http", "access": "public", "writeToEnvironmentFile": { "endpoint": "PROVISIONOUTPUT__AZUREWEBAPPBOTOUTPUT__SITEENDPOINT", // you need to update the environment variable name here "domain": "PROVISIONOUTPUT__AZUREWEBAPPBOTOUTPUT__DOMAIN" // you need to update the environment variable name here } } ], "env": "local" }, "isBackground": true, "problemMatcher": "$teamsfx-local-tunnel-watch" }
This step is only required when your project contains bot or message extension. If your ARM template generates different environment variable, update the environment variable name in above sample.
-
After above steps, you should be able to develop your Teams app with Teams Toolkit 5.0. Please read Feature changes that impact your development flow to understand how development flow changes in Teams Toolkit 5.0.
The project to be upgraded has no appPackage folder under templates which is required for Upgrade. You can refer to upgrade your projects manually to upgrade your project manually.
The project to be upgraded has no manifest.template.json file under templates/appPackage which is required for Upgrade. You can refer to upgrade your projects manually to upgrade your project manually.
The project to be upgraded has no aad.template.json file under templates/appPackage which is required for your project. You may be trying to upgrade a project created by Teams Toolkit for VS Code <= v3.8 / Teams Toolkit for Visual Studio <= v17.3 / Teams Toolkit CLI 0.x. Please install Teams Toolkit for Visual Studio Code v4.x / Teams Toolkit for Visual Studio v17.4 / Teams Toolkit CLI v1.x and run upgrade first, or refer to upgrade your projects manually to upgrade your project manually.
Build Custom Engine Copilots
- Build a basic AI chatbot for Teams
- Build an AI agent chatbot for Teams
- Expand AI bot's knowledge with your content
Scenario-based Tutorials
- Send notifications to Teams
- Respond to chat commands in Teams
- Respond to card actions in Teams
- Embed a dashboard canvas in Teams
Extend your app across Microsoft 365
- Teams tabs in Microsoft 365 and Outlook
- Teams message extension for Outlook
- Add Outlook Add-in to a Teams app
App settings and Microsoft Entra Apps
- Manage Application settings with Teams Toolkit
- Manage Microsoft Entra Application Registration with Teams Toolkit
- Use an existing Microsoft Entra app
- Use a multi-tenant Microsoft Entra app
Configure multiple capabilities
- How to configure Tab capability within your Teams app
- How to configure Bot capability within your Teams app
- How to configure Message Extension capability within your Teams app
Add Authentication to your app
- How to add single sign on in Teams Toolkit for Visual Studio Code
- How to enable Single Sign-on in Teams Toolkit for Visual Studio
Connect to cloud resources
- How to integrate Azure Functions with your Teams app
- How to integrate Azure API Management
- Integrate with Azure SQL Database
- Integrate with Azure Key Vault
Deploy apps to production