Upload and test the custom apps in Teams environment v4
Important
We've introduced the Teams Toolkit v5 extension within Visual Studio Code. This version comes to you with many new app development features. We recommend that you use Teams Toolkit v5 for building your Teams app.
Teams Toolkit v4 extension will soon be deprecated.
After adding API connection, you can test API connection in the Teams Toolkit local environment and deploy your application to the cloud. In CI/CD pipeline, after set-up with different platform, you need to create Azure service principal to provision and deploy resources.
In this section, you'll learn:
- Test API connection in local environment
- Deploy your application to Azure
- Provision and deploy CI/CD resources
Test API connection in local environment
The following steps help to test the API connection in the Teams Toolkit local environment:
Run npm install
Run
npm install
underbot
orapi
folder to install added packages.Add API credentials to the local application settings
Teams Toolkit doesn't ask for credentials, but it leaves placeholders in the local application settings file. Replace the placeholders with the appropriate credentials to access the API. The local application settings file is the
.env.teamsfx.local
file in thebot
orapi
folder.Use the API client to make API requests
Import the API client from the source code that needs access to the API:
import { yourApiClient } from '{relative path to the generated file}'
Generate http(s) requests to target API (with Axios)
The generated API client is an Axios API client. Use the Axios client to make requests to the API.
Note
Axios is a popular nodejs package that helps you with http(s) requests. For more information on how to make http(s) requests, see Axios example documentation to learn how to make http(s).
Deploy your application to Azure
To deploy your application to Azure, you need to add the authentication to the application settings for the appropriate environment. For example, your API might have different credentials for dev
and prod
. Based on environment needs, configure Teams Toolkit.
Teams Toolkit configures your local environment. The bootstrapped sample code contains comments that tell you what app settings you need to configure. For more information on application settings, see Add app settings
Provision and deploy CI/CD resources
To provision and deploy resources targeting Azure inside CI/CD, you must create an Azure service principal for use.
Perform the following steps to create Azure service principals:
- Register a Microsoft Entra application in single tenant.
- Assign a role to your Microsoft Entra application to access your Azure subscription. The
Contributor
role is recommended. - Create a new Microsoft Entra application secret.
Tip
Save your tenant id, application id (AZURE_SERVICE_PRINCIPAL_NAME), and the secret (AZURE_SERVICE_PRINCIPAL_PASSWORD) for future use.
For more information, see Azure service principals guidelines. The following are the three ways to create service principals:
See also
Feedback
Submit and view feedback for