msteams — Microsoft permissions reference
This reference separates the bot's application permissions, Teams resource-specific consent and the delegated scopes used by Microsoft 365 tools.
Setting this plugin up is not one consent screen. There are four independent permission surfaces, each configured in a different portal and approved by a different person. Getting one right tells you nothing about the others, and three of the four are optional — the plugin degrades to a narrower feature set instead of failing to start.
| # | Surface | Configured in | Consented by | Optional? |
|---|---|---|---|---|
| 1 | Bot identity | Azure Bot resource + Entra app | nobody (no Graph permission at all) | required |
| 2 | Application Graph permissions | Entra → the bot app → API permissions | tenant admin, once | optional (graphLookup) |
| 3 | Resource-specific consent (RSC) | the Teams app package manifest | a team owner, per team | optional (channelMessagesRsc) |
| 4 | Delegated Graph scopes | a second Entra app + Bot Framework OAuth connection | tenant admin, then each user at first sign-in | optional (accountLinking) |
Personal Email mailboxes add a separate delegated web-mail consent on the bot app.
Unlike surface 4, msteams stores those refresh tokens in the owner's encrypted vault; the
MicrosoftOutlook tool continues using surface 4 unchanged.
Surface 5 lists the redirect URIs an Entra administrator configures for these separate sign-ins.
1. Bot identity — needs no Graph permission
The chat itself runs entirely on the Bot Connector, not on Graph. Nothing in this section requires an API permission or admin consent.
- One Entra app registration,
signInAudience: AzureADMyOrg(single tenant). Its Application (client) ID becomes the plugin'sappId, the directory ID becomestenantId, and a client secret becomesappPassword. - One Azure Bot resource with
msaAppType: SingleTenant, bound to that app id and tenant, messaging endpointhttps://<public-host>/hooks/msteams/messages, with the Teams channel enabled. - Outbound calls authenticate with the fixed scope
https://api.botframework.com/.default(SCOPEinlib/connector.mjs), issued by the tenant token endpoint built fromtenantId(TokenSourceinlib/token.mjs).
The plugin refuses to connect at all until appId, appPassword and tenantId are all set — no platform,
no webhook, no tools (register in index.mjs).
With only this surface configured the bot can read and reply in any chat or channel it has been added to, but it can only reach people it has already seen.
Account identity evidence and linking
The configured plugin contributes teamsIdentity from lib/identity.mjs through the existing
ctx.registerPlatform(adapter, { identity: teamsIdentity }) seam. Without the three bot credentials,
neither an adapter nor usable identity rules are registered; stored account links remain untouched.
Normalization is synchronous, pure and idempotent: trim and lowercase. Validation preserves the existing
Entra GUID syntax and 29: followed by 10–250 ASCII word characters or hyphens, including underscores.
It does not accept 8:orgid:<guid>. Changing this equality requires a coordinated stored-data migration.
Core owns resolution and persistence, not another Teams account store. The trust order is the explicit
canonical platform link first, then a unique external subject binding under provider msteams, then
a unique caller-verified email (verifiedEmailUnique: true). Ambiguous tenant subject bindings do not
select an account; absent or ambiguous email does not bootstrap one. A successful email match persists
only a valid canonical sender. Invalid inbound syntax never clears an existing link, while an explicit
invalid account edit retains its clear behavior.
This declaration does not authenticate an email. The unchanged adapter authenticates inbound activities
through the Bot Framework JWT boundary and obtains email/UPN evidence from the Connector conversation
roster, not sender-supplied email fields. Core trusts the caller's verifiedEmail argument; it does not
independently verify that address. Loaded plugins remain trusted in-process code. Do not pass arbitrary
user input as verified email or interpret the bootstrap flag as an email-verification mechanism.
Linking grants no administrator role, Project membership, tool access or plugin permission. Existing personal-chat OAuth admission, tenant/member verification and delegated Graph consent remain separate and unchanged; identity registration neither replaces them nor broadens their authority.
Browser SSO policy is projected by createMicrosoftSsoControl(ctx) through the core-only
microsoftSso.configuration control, registered even before the transport credential gate. Each call
reads current configuration: disabled/incomplete settings return null, malformed configured policy
throws, and the credential-bearing result never enters user routes or discovery. Core owns OIDC, PKCE,
sessions and the single external-account provisioner; the plugin owns provider/project policy.
microsoftAccountProjects supplies the same personal-or-existing Project selection to browser SSO and
verified delegated provisioning. It grants nothing itself: core validates active Projects and refuses
an unusable new-account selection. The complete six-method peer microsoftIdentity contract remains
separate; Email and OneDrive resolve it with microsoftIdentityMethods, never a copied drive-only shape.
2. Application Graph permissions — on the bot app
These use the bot's own app-only token, so they apply tenant-wide and need tenant admin consent. They exist to close exactly one gap: writing to somebody the bot has never met.
Turn the feature on with graphLookup. While it is off, the adapter constructor builds no GraphClient, so
none of these permissions are exercised. The channel-history reader is the only other Graph consumer. It is
created only when channelMessagesRsc is on (threadReader in lib/transcript.mjs), reuses the directory's
client when graphLookup is also on, and needs ChannelMessage.Read.Group from section 3, not the permissions
in this table.
| Permission | Required for | Call |
|---|---|---|
User.ReadBasic.All |
Resolving an e-mail address to a tenant user | GET /users/{address}, then a $filter fallback on mail/userPrincipalName (findUser in lib/graph.mjs) |
TeamsAppInstallation.ReadWriteSelfForUser.All |
Installing the Teams app for that user so a 1:1 chat can be opened | POST /users/{id}/teamwork/installedApps (installApp in lib/graph.mjs) |
ProfilePhoto.Read.All |
Directory avatars in the admin people list — optional | GET /users/{id}/photos/48x48/$value (userPhoto in lib/graph.mjs) |
ProfilePhoto.Read.All degrades gracefully: without it the photo fetch fails, the plugin logs one warning
naming the permission and then stops asking for five minutes, the people list falls back to the linked
Elowen account avatar and then to initials, and everything else keeps working (userPhoto).
Path: Entra admin center → App registrations → the bot's app → API permissions → Add a permission →
Microsoft Graph → Application permissions → the permission → Grant admin consent for the tenant. On a
401/403 the plugin quotes this exact path back at you with the missing permission name filled in, instead
of forwarding a bare status code (consentHelp and GraphClient.call in lib/graph.mjs).
Do not over-grant. The plugin does not use AppCatalog.Read.All or GroupMember.Read.All on the bot app. The catalog entry is supplied by configuration
(graphCatalogAppId), not looked up, and group membership is read through the delegated connection in
surface 4. A new instance should leave both out.
graphCatalogAppId is not appId
Installing the app for a user binds appCatalogs/teamsApps/{graphCatalogAppId} (installApp). That
id is the app's entry in the organisation's Teams catalog (Teams admin center → Manage apps → the
uploaded app), which is a different GUID from the bot's appId. Leave it empty only when the app is
already pushed to users by a Teams app policy; the plugin then skips the install and opens the chat
directly (findPersonViaGraph in lib/proactive.mjs).
3. Resource-specific consent — in the Teams app package
RSC is the one surface no tenant admin touches. A team owner approves it when the app package is installed or updated in their team, and it applies only inside that team.
Enabling channelMessagesRsc adds this block to the generated app package (appManifest in lib/appPackage.mjs):
"authorization": {
"permissions": {
"resourceSpecific": [{ "type": "Application", "name": "ChannelMessage.Read.Group" }]
}
}
| Permission | Type | Buys you |
|---|---|---|
ChannelMessage.Read.Group |
Application (RSC) | In a team where the app is installed, the bot sees every channel message instead of only @mentions, which is what fills the conversation history backfill (historyLimit) |
Teams accepts this instead of the tenant-wide ChannelMessage.Read.All, and it is the least-privileged
option for the job — which is the whole reason it is used (the PERM_READ_CHANNEL_MESSAGES comment in lib/graph.mjs).
Two traps:
- The setting alone changes nothing. The package has to be re-downloaded and re-uploaded into the team, and the team owner has to accept the new permission prompt.
- Reading a channel message still only sees it. In a team channel, Teams delivers a message to a bot only
when it is
@mentioned— that is a Teams rule andrespondWithoutMentiondoes not override it.
webApplicationInfo (id = the bot appId, resource = any valid URL) is required by the manifest schema
whenever RSC is declared; the resource value is otherwise unused (appManifest).
4. Delegated Graph scopes — the second app registration
This is the surface people miss, because it lives on a separate Entra app registration from the bot.
It powers the Microsoft 365 tools (MicrosoftOutlook, MicrosoftFiles, MicrosoftSharePoint,
MicrosoftDirectory, MicrosoftTeams, …; the full list of eight is in the
Microsoft 365 page). Every call runs as the signed-in person
with that person's own rights, never as the bot — so the tools can never reach a document the user could
not open themselves. Tokens are held by the Bot Framework Token Service, not by Elowen.
The wiring
- Create a second Entra app registration (single tenant), separate from the bot app.
Give it the redirect URI
https://token.botframework.com/.auth/web/redirectand a client secret. - Add the delegated scopes below to it and grant admin consent for the tenant.
- On the Azure Bot resource, add a Connection Setting:
- Service provider: Azure Active Directory v2
- Client id / secret: from the second app
- Tenant ID: your tenant
- Token Exchange URL: leave empty
- Scopes: the list below, space-separated
- Put the connection's exact name into the plugin's
oauthConnectionName, and switchaccountLinkingon.
The scopes
Choose only the workloads actually needed; this is not a request to expand an existing connection. All implemented Microsoft* tools and digest use delegated work/school access, never application-token fallback. Microsoft mandatory administrator-consent flags below are distinct from a tenant policy that may require approval more broadly. Generic 403 proves neither missing consent nor licence.
| Operation | Delegated permission | Mandatory admin | Application equivalent (not used) |
|---|---|---|---|
| Verify linked human | User.Read; existing openid profile email offline_access sign-in | No | /me unsupported |
| Relevant people | People.Read | No | Not used |
| Full directory profile/photo metadata | User.Read.All | Yes | User.Read.All, admin Yes |
| Group membership | GroupMember.Read.All | Yes | GroupMember.Read.All, admin Yes |
| SharePoint sites/lists/columns/items/pages/simple search reads | Sites.Read.All | No | Sites.Read.All, admin Yes |
| Discover site libraries | Files.Read | No | Files.Read.All, admin Yes |
| SharePoint writes | Sites.ReadWrite.All | No | Sites.ReadWrite.All, admin Yes |
| Federated files search / metadata delta | Files.Read.All (Search also accepts Sites.Read.All) | No | Files.Read.All/Sites.Read.All, admin Yes, only supported file endpoints |
| Federated mail search | Mail.Read | No | Search mail unsupported |
| Federated Teams chat search | Chat.Read | No | Search Teams unsupported |
| Federated channel message coverage | ChannelMessage.Read.All | Yes | Search Teams unsupported |
| Stable federated people search | Unsupported; use MicrosoftDirectory search_people | No scope requested | Unsupported here |
| Existing MicrosoftFiles read/write workflow | Files.ReadWrite.All | No | Not used |
| Digest subscription lifecycle | Files.ReadWrite.All | No | Files.Read.All/Files.ReadWrite.All, admin Yes, not implemented |
| Outlook calendar readiness | Calendars.ReadBasic | No | /me unsupported |
| Suggest meeting times | Calendars.Read.Shared; higher Calendars.ReadWrite.Shared accepted | No | findMeetingTimes unsupported |
| Existing calendar writes / delegated shared calendar | Calendars.ReadWrite / Calendars.ReadWrite.Shared | No | Not used |
| Existing mail read/write/send | Mail.ReadWrite / Mail.Send; shared variants when needed | No | Not used |
| Existing contact writes | Contacts.ReadWrite | No | Not used |
| To Do / basic Planner reads | Tasks.Read | No | Tasks.Read.All, admin Yes where supported |
| To Do / basic Planner writes | Tasks.ReadWrite | No | Tasks.ReadWrite.All, admin Yes where supported |
| OneNote readiness/read | Notes.Read / Notes.Read.All | No | Application authentication retired 2025-03-31 |
| Sourced OneNote page / read-write workflow | Notes.Create minimum for create; Notes.ReadWrite implemented; Notes.ReadWrite.All higher existing grant | No | Application authentication retired |
| Excel range/table-range, including read-only report | Files.ReadWrite | No | Unsupported |
| Teams chat reads / quote source | Chat.Read | No | Same-name permission unavailable |
| Chat send / quote / react | ChatMessage.Send | No | Same-name permission unavailable |
| Team / channel metadata | Team.ReadBasic.All / Channel.ReadBasic.All | No | Same-name permissions, admin Yes |
| Channel roots / full thread page | ChannelMessage.Read.All | Yes | Same-name permission, admin Yes, not used |
| Channel send / reply / react | ChannelMessage.Send | No | Same-name permission unavailable |
| Join-URL meeting lookup | OnlineMeetings.Read | No | /users OnlineMeetings.Read.All, admin Yes, not used |
| List/read existing meeting transcripts | OnlineMeetingTranscript.Read.All | Yes | Same-name permission, admin Yes and meeting application policy, not used |
| Own / selected colleague Presence | Presence.Read / Presence.Read.All | No | Presence.Read.All, admin Yes, not used |
Basic Planner operations need no Group.ReadWrite.All. GroupMember.Read.All is separate directory access, not a task write prerequisite. Quote sends require both Chat.Read and ChatMessage.Send. Chatmessage-post currently lists ChannelMessage.Send in its chat table; the permission reference and reaction endpoint define ChatMessage.Send for chats, which is the implemented hint. Bot RSC history remains a separate authority, not a delegated thread fallback.
Subscription CREATE currently documents Files.Read.All for business drives while GET/UPDATE/DELETE/LIST still document Files.ReadWrite.All. The supported lifecycle bundle is therefore Files.ReadWrite.All; do not promise read-only consent is sufficient. Root subscriptions filter explicitly selected files through authoritative delta; selected SharePoint libraries do not include site lists/pages or future libraries. Requested lifetime is only one hour.
Transcript scopes are optional and requested only for deliberate default-off rollout/reconnect, with administrator approval for OnlineMeetingTranscript.Read.All. No recording scope is requested. Artifacts support scheduled calendar-associated, unexpired meetings; ambiguous 404/410 stays unavailable rather than a fabricated expiry/licence cause. Presence is an explicit current snapshot, never location, attendance history, caching or subscriptions.
Primary Microsoft references checked for this integration: permission definitions and consent flags, Search query, Search coverage, indexed list filters, meeting suggestions, transcripts, subscription create, subscription delete, OneNote authentication, presence, Excel range.
Scope changes need the connection rewritten, not just consented
The Azure connection stores its requested list in the top-level scopes property and portal parameters. Audit that list and explicit consent before reconnecting; a successful login or one narrow readiness read is not proof of every grant. This integration does not inspect effective tenant consent metadata and does not change live configuration. offline_access preserves the existing Bot Token Service refresh lifecycle. Personal Email remains independent.
5. Redirect URIs — for web sign-in
Three independent redirect URIs across the bot and delegated apps. Redirect URIs are not permissions.
| App | Redirect URI | Used by |
|---|---|---|
| the bot app | <ssoRedirectBase>/api/auth/sso/microsoft/callback |
the Microsoft button on the Elowen login page (ssoEnabled) |
| the delegated app | https://token.botframework.com/.auth/web/redirect |
the Bot Framework OAuth connection in surface 4 |
| the bot app | <canonical-public-web-url>/p/msteams/mail/callback |
personal mailbox sign-in from Email, separate from SSO and Teams OAuth |
The web-sign-in URI is built from the single configured public URL (redirectUri in src/auth/msSso.ts),
so ssoRedirectBase must be the address people actually sign in at.
Personal mail consent on the bot app
For Email's Microsoft option, open API permissions → Add a permission → Microsoft Graph →
Delegated permissions, add User.Read, Mail.ReadWrite, Mail.Send and MailboxSettings.ReadWrite,
then grant administrator consent for the configured tenant. The mail-only flow requests
offline_access User.Read Mail.ReadWrite Mail.Send MailboxSettings.ReadWrite
and uses authorization code + PKCE, with the same appId, appPassword and tenant GUID as the bot.
Register the callback above as a Web redirect URI under Authentication; do not use an SPA
registration or the Bot Framework redirect for this flow.
The category scope is added only to this personal-mail flow, never the web login, Teams OAuth
connection or drive delegation. Existing mailbox grants without the stored category scope return
null from mailGraphFor, so Email's existing reconnect flow requests consent again. The mailbox ref,
account preferences and polling state are retained; refreshing an old token never substitutes for
explicit consent.
Microsoft's category listing
requires MailboxSettings.Read; category creation
requires MailboxSettings.ReadWrite. The latter is requested for both reads and writes. Category names
are immutable: update
changes only color, not displayName (checked 2026-10-21). An operator must grant the delegated
permission and tenant administrator consent before users reconnect. This is a deployment prerequisite,
not a permission this plugin can add to Entra itself.
Each Elowen account connects its own mailboxes with prompt=select_account. Only that tenant is
addressed, and mail-scoped consumers never get tokens or access to drives, calendars or the directory.
Disconnect removes the local credential, not the remote mailbox or tenant-wide consent. For storage,
control signatures and the coordinated release/access prerequisites, see
personal web mail sign-in.
Setting up a new tenant — checklist
Entra → App registrations → new registration, single tenant. →
appId,tenantId, client secret →appPassword.Azure Bot resource, SingleTenant, bound to that app; messaging endpoint
https://<host>/hooks/msteams/messages; enable the Teams channel.Fill
appId,appPassword,tenantIdin the plugin and confirm it connects. Stop here if you only need chat.Web sign-in: add
<public-url>/api/auth/sso/microsoft/callbackto the bot app's redirect URIs, setssoRedirectBase, switch onssoEnabled.Proactive messaging: grant
User.ReadBasic.All+TeamsAppInstallation.ReadWriteSelfForUser.All(Application) with admin consent, upload the app to the org Teams catalog, put its catalog id ingraphCatalogAppId, switch ongraphLookup.Channel history: switch on
channelMessagesRsc, re-download the app package, re-install it in each team, have a team owner accept the prompt.Microsoft 365 tools: second app registration + Bot Framework OAuth connection with only the delegated scopes required by the selected operations in section 4; obtain administrator approval where that table or tenant consent policy requires it, then reconnect explicitly. Set
oauthConnectionNameandaccountLinking. Choosem365AccessMode—read_onlyblocks every external mutation,read_writestill previews each mutation before the agent commits it. Local digest selection does not enable alerts; only the human-owned setting does.Personal mail in Email: add the bot app's mail callback as a Web redirect, grant the four delegated Graph permissions above and administrator consent, then install the coordinated core/plugin versions. This does not require changing
MicrosoftOutlookor the Bot Framework OAuth connection.
Traps, collected
- Two app registrations, not one. The bot app and the delegated-access app are separate. Reusing the bot app for the OAuth connection means its redirect URI and consent set have to carry both jobs.
ChannelMessage.Read.AllandChannelMessage.Read.Groupare different things. The first is a delegated scope on the delegated app (surface 4). The second is an application RSC permission in the Teams package (surface 3). Having one does not give you the other.graphCatalogAppId≠appId.- RSC needs a package re-upload, not just the config switch.
offline_accessis not optional in practice — without it the delegated connection dies after the first token expires.- Saved configuration may still be pending. Credentials and policy changes become effective after the host-requested daemon restart. Until then the current adapter keeps its previous configuration.
- The plugin's config hints carry the click-path.
graphLookup,oauthConnectionName,ssoRedirectBase,graphCatalogAppIdandchannelMessagesRsceach spell out what the admin has to do, so the setting screen is usable without this page.