This project is tabs app add-in for Microsoft Teams.
- Client side: ReactJS
- Server side: NodeJS
- NodeJS
- An M365 account. If you do not have M365 account, apply one from M365 developer program
- Teams Toolkit Visual Studio Code Extension version after 1.55 or TeamsFx CLI
If you want to run in localhost, you can use 2 options.
- With server-side code
- Without server-side code: SSO authentication provided by teams toolkit
- Install package
npm run installAll
- Register new App in Portal Azure
You can hit the
F5
key in VS Code (Teams tookit will auto create new app and setup everything) or create by yourself Register an Azure AD App - Edit
.env
for tabs
- Open folder
tabs
- Open your app in 2. and copy
Application (client) ID
- copy
.env.sample
and rename file to.env
. Then paste your App id inREACT_APP_CLIENT_ID
- Upadate
Application (client) ID
inauth-start.html
(client side) - Edit
.env
for server
- Open folder
server
- Open your app in 2. and copy
Certificates value
(3rd column in below figure). If you can't copy value, you can create new one (clickNew client secret
) - copy
.env.sample
and rename file to.env
. Then paste your App id inCLIENT_ID
and Certificates value inCLIENT_SECRET
- Run client side (tabs) in local
cd tabs
andnpm run start
- Run server side in local
cd server
andnpm run start
- Upload Manifest
- go to folder
manifest
- copy file
manifest.sample.json
and rename tomanifest.json
- cd .fx/states/state.local.json and copy value
{{fx-resource-appstudio.teamsAppId}}
= teamsAppId{{localSettings.auth.clientId}}
= clientId{{{localSettings.auth.applicationIdUris}}}
= applicationIdUris - If you have no localSetting.json, hitting
F5
or you can copy value from your app overview in Portal Azure (teamsAppId can be any value in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) - Compress manifest.json and folder resources to zip file.
- open MS Teams app in browser. Then click Apps> Upload a custom app and upload your zip file
- go to folder
- npm run installAll
- hitting the
F5
key in Visual Studio Code.
cd server
andnpm run start
- Install ngrok and run
ngrok http 55000
- Copy your path forwarding
https://xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx.ngrok.io
Firebase Tutorial - How to Set Up and Deploy with ReactJS
cd tabs
- Copy
.env.sample.production
and rename to.env.production
- Change
REACT_APP_TEAMSFX_ENDPOINT
to ngrok path forwarding npm run build:production
firebase deploy
NOTE: If you use free version ngrok, the path was change after you terminate the server side.
So you must update .env.production
, npm run build:production
, and deploy
-
cd manifestProd
-
copy file
manifest.sample.json
and rename tomanifest.json
-
edit
https://tab-sso-client.web.app
to your client domain -
edit
webApplicationInfo.resource
toapi://{your-client-domain}/{your-app-client-id-from-portalAzure}
such asapi://tab-sso-client.web.app/84a71487-45a8-4504-8aa5-e5xxxxxxxxxx
-
Add
redirectUri
in Portal Azure NOTE: It must be your client domain -
Update
Expose API
in portal Azure. The value be the same as 4. NOTE: IfwebApplicationInfo.resource
not be the same asexpose api
in azure portal, the error resourceDisabled was found. -
Compress manifefst to zip and upload in MS Teams for testing.
You can find the Teams app manifest in templates/appPackage
folder. The folder contains two manifest files:
manifest.local.template.json
: Manifest file for Teams app running locally.manifest.remote.template.json
: Manifest file for Teams app running remotely (After deployed to Azure).
Both files contain template arguments with {...}
statements which will be replaced at build time. You may add any extra properties or permissions you require to this file. See the schema reference for more information.
Deploy your project to Azure by following these steps:
From Visual Studio Code | From TeamsFx CLI |
---|---|
|
|
Note: Provisioning and deployment may incur charges to your Azure Subscription.
To check that your manifest file is valid:
- From Visual Studio Code: open the Teams Toolkit and click
Validate manifest file
or open the command palette and select:Teams: Validate manifest file
. - From TeamsFx CLI: run command
teamsfx validate
in your project directory.