This app showcase how to access a AAD secured REST API with SSO from a M365 Copilot plugin developed by using ai-library.
- this sameple was original created based on M365 copilot northwind plugin sample. the original sample used Azure storage DB. The sample introduced a REST API to access Northwind DB from a Cosmos DB. For the copmlete REST API sample, please refer to frankchen76 / northwinddb-api
- follow Add single sign-on to Teams app to add SSO which will
- create .env.local under env folder.
# This file includes environment variables that can be committed to git. It's gitignored by default because it represents your local development environment.
# Built-in environment variables
TEAMSFX_ENV=local
APP_NAME_SUFFIX=local
# Generated during provision, you can also add your own variables.
BOT_ID=
TEAMS_APP_ID=
BOT_DOMAIN=
BOT_ENDPOINT=
# NorthwindDb API
NORTHWINDDBAPI_ENDPOINT=[rest-api-endpoint]
# Debug flag
DEBUG=northwinddb-msteamext
- create .env.local.user under env folder.
# This file includes environment variables that will not be committed to git by default. You can set these environment variables in your CI/CD system for your project.
# If you're adding a secret value, add SECRET_ prefix to the name so Teams Toolkit can handle them properly
# Secrets. Keys prefixed with `SECRET_` will be masked in Teams Toolkit logs.
SECRET_BOT_PASSWORD=
- the smaple uses ngrok with predefine domain, if you want to use OOTB dev tunnel, please uncomment out "Start local tunnel" in .vscode/tasks.json. like below
{
"label": "Start Teams App Locally",
"dependsOn": [
"Validate prerequisites",
"Start local tunnel",
"Provision",
"Deploy",
"Start application"
],
"dependsOrder": "sequence"
},
Prerequisites
To run the template in your local dev machine, you will need:
- Node.js, supported versions: 16, 18
- A Microsoft 365 account for development
- Set up your dev environment for extending Teams apps across Microsoft 365 Please note that after you enrolled your developer tenant in Office 365 Target Release, it may take couple days for the enrollment to take effect.
- Teams Toolkit Visual Studio Code Extension version 5.0.0 and higher or Teams Toolkit CLI
- First, select the Teams Toolkit icon on the left in the VS Code toolbar.
- In the Account section, sign in with your Microsoft 365 account if you haven't already.
- Press F5 to start debugging which launches your app in Teams using a web browser. Select
Debug (Edge)
orDebug (Chrome)
. - When Teams launches in the browser, select the Add button in the dialog to install your app to Teams.
- To trigger the Message Extension, you can:
- In Teams:
@mention
Your message extension from thesearch box area
,@mention
your message extension from thecompose message area
or click the...
under compose message area to find your message extension. - In Outlook: click the
More apps
icon under compose email area to find your message extension.
- In Teams: