Set up Microsoft Teams service credential
A Microsoft Teams service credential lets a Glean agent use a shared application identity rather than an individual user's account. Use it to publish a standalone Teams app or attach it to an agent for authenticated Microsoft Teams API calls.
Glean handles authentication for supported requests. The credential's authentication and access work as follows:
- Authentication: Microsoft Entra application identity through OAuth 2.0 client credentials.
- Read access: The Microsoft Graph application permissions you grant to the app determine what the agent can read.
- Sends and replies: Use the configured Teams bot and Bot Framework, not Microsoft Graph read permissions. Access depends on the bot configuration and where the app is installed.
Standalone apps work in one-to-one direct messages, not channels or group chats. This setup is separate from configuring the main Glean app for direct messages and channel replies. See Glean in Microsoft Teams: Admin guide.
Attaching a credential for API access doesn't publish a standalone app. To publish one, create and publish the app in Microsoft Teams, save its credentials in Glean, and link it to the agent.
Prerequisites
Complete the following prerequisites:
- Have access to create and manage an app registration and bot in Azure, configure an app in Teams Developer Portal, and publish it through Teams Admin Center.
- Work with a Glean administrator who can create service credentials and give agent builders access to use them.
- Have Glean in Microsoft Teams configured and enabled for the app's tenant. Creating a standalone app and credential doesn't enable this integration.
- Publish the agent with a Chat message trigger. Have permission to edit the agent and configure its publishing settings.
- Give the intended users access to the agent in Glean. Installing the Teams app or granting access to its credential doesn't grant access to the agent.
Create and publish the Teams app
Create a separate app for the agent. Each app credential can link to one agent at a time, and one agent can use several apps.
-
Complete Phase 1 and Phase 2 of the Teams admin guide to create the Azure Bot, configure the Teams app, and publish it to your organization. Use a name that identifies the agent. See Phase 1: Set up Azure Bot and Glean app.
For a standalone app, select the Personal bot scope. The Team scope and
ChannelMessage.Read.Grouppermission in the main-app guide are for channel replies, which standalone agent apps don't support. -
Use the same Microsoft app registration for the Azure Bot, the Teams app's bot configuration, and the service credential. Configure it as Single Tenant. Copy the Application (client) ID, Directory (tenant) ID, and client secret value from that registration.
-
If your Teams integration is bot-only and doesn't sync user identities, open API permissions in the app registration. Add the Microsoft Graph Application permission
User.Read.Alland click Grant admin consent. Glean needs this permission to identify message senders, even when the agent doesn't use Teams API tools. -
After publishing the app, copy its App ID from Teams Admin Center. Use the Teams app ID, not the Azure application client ID.
Don't enter the standalone app's credentials in the main Glean app's Setup section. Create a service credential instead.
Create the service credential in Glean
Store the app details once, then select this credential when linking the agent:
-
Go to Admin console → Tools → Service credentials.
-
Click Add and select Microsoft Teams App.
-
Enter a Credential name and Description that identify the app.
-
Enter the following app details:
Field Value Application (Client) ID The application client ID from the Microsoft app registration Client Secret The client secret value from Certificates & secrets, not the secret ID Directory (Tenant) ID The tenant ID from the app registration's Overview page Teams App ID The Teams app ID from Teams Admin Center -
Set Who can use this credential to the users or groups who can use this credential with agents.
-
Click Save and resolve any validation errors.
The credential audience controls which builders can select the credential in Glean. Your Teams app availability settings control who can install the app in Teams. Users also need access to the linked agent in Glean.
Link the service credential to your agent
Choose either Agent builder or the Admin console to manage the same app links. You don't need to complete both paths.
Saving these settings updates the published agent's app links.
Publish a standalone Teams app
Link the app from the agent's sharing settings:
- Open the published agent in Agent builder and click Share.
- Under Publishing options, select Microsoft Teams.
- Turn on Make this agent available in Microsoft Teams.
- Under Select apps to deploy this agent to, select the credential you created. Click Add another app to link another Teams app.
- Save the sharing settings:
- For workflow agents, click Update, then Done in the Share dialog. If Next appears instead, click it and review the agent details before confirming.
- For autonomous agents, click Save.
Link from the Admin console
Use this path to manage app links without opening the agent:
- Go to Admin console → Embedded integrations → Glean in Microsoft Teams and select the connector instance for the app's tenant.
- In the Glean Agents section, click Add agent.
- Select the agent and its Microsoft Teams credential.
- Click Save.
The picker includes only published agents with a Chat message trigger that you have permission to edit and configure for publishing. The Teams credential picker lists credentials for the connector instance you selected. A credential already linked to another agent isn't available for a new link.
The service-credential flow doesn't impose a limit on the number of agents you can link.
Unlink an app
In Glean Agents, click the app link's unlink control and confirm with Unlink. This removes the app's publishing connection to the agent. Its other app links remain unchanged.
Removing the app link doesn't uninstall the Teams app or delete the saved service credential. It also doesn't detach that credential from the agent's API tools.
You can also remove the app from the agent's publishing settings and save. To remove the last Teams app from those settings, turn off Make this agent available in Microsoft Teams before saving.
Verify the standalone app
Test the published app with a Glean user who has access to the linked agent:
- Open Apps in Microsoft Teams and find the app by its configured name.
- Add the app and open a one-to-one direct message.
- Send a question and confirm that the linked agent responds.
A successful credential validation isn't a substitute for this test. Check the bot endpoint and app availability if the agent doesn't respond.
Use the credential for API access
Attaching the credential for API access is separate from publishing the app. Do this only if the agent needs to read Teams data or make supported API calls through this identity. The User.Read.All requirement for bot-only integrations applies even when you don't attach the credential as a tool.
Grant Microsoft Graph read permissions
In the existing app registration, open API permissions and add the Microsoft Graph Application permissions the agent needs. Don't create a second app registration for the same bot.
Choose permissions for the data the agent needs to read:
| Permission | Use when the agent needs to |
|---|---|
User.Read.All | Find users in the directory |
Team.ReadBasic.All | Discover teams |
GroupMember.Read.All | Read Microsoft 365 group membership |
ChannelMember.Read.All | Read channel membership |
ChannelSettings.Read.All | Read channel settings |
ChannelMessage.Read.All | Read channel messages across the tenant |
Chat.Read.All | Read chats across the tenant |
Click Grant admin consent, then confirm that each required permission shows a granted status. These permissions control Microsoft Graph reads. They don't enable standalone apps to respond in channels.
Attach the credential as a tool
To give the agent authenticated API access, open the agent's Tools → Service credentials tab and select the credential. Glean supplies authentication for supported requests. Microsoft Graph handles reads, while the configured bot uses Bot Framework for sends and replies.
Test a read against a resource covered by the granted permissions. An application identity doesn't inherit the permissions of the user chatting with the agent.
Security and operational notes
- Use a separate app registration for the agent app rather than reusing the main Glean app's credentials.
- Grant only the Microsoft Graph permissions needed to identify message senders and perform the agent's API calls.
- Rotate the client secret by creating a replacement, updating the credential in Glean, and verifying it before revoking the old secret.
Troubleshooting
Check the app configuration, credential, and agent eligibility when setup fails.
See also
- Glean Agents in Microsoft Teams: Set up agent app links and help users find their app.
- Agent identity overview: Understand service credentials and application identities.