> ## Documentation Index
> Fetch the complete documentation index at: https://docs.komodor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Teams

> Connect Microsoft Teams as a two-way bot or as webhook-only notifications, grant its Microsoft permissions, and route Teams messages to agents.

The Komodor Agentic Operation Platform (KAOP) connects to Microsoft Teams through an Azure Bot you
register in your own Entra ID tenant, or through a Teams Workflows webhook that only receives
notifications. One Teams tenant connects to one KAOP account, and every optional Microsoft permission
below states what you lose by skipping it.

Microsoft Teams appears under **Integrations** once Komodor enables it for your account. Until then
the connect form says *Microsoft Teams is not available here*, and Teams connections, notification
sinks and incident destinations are refused. Ask your Komodor contact to enable it.

## Before you start

| Who | Needed for |
| - | - |
| A KAOP account admin who can manage integrations | Connecting the bot, routing rules |
| A KAOP user who can create notification sinks | Webhook-only mode, notification sinks |
| An Entra ID user who can register applications | The app registration and its client secret |
| An Azure subscription contributor | The Azure Bot resource |
| A Teams admin, or a user allowed to upload custom apps | Installing the Teams app package |
| An Entra ID admin who can grant consent (Privileged Role Administrator or Global Administrator) | The optional Microsoft Graph permissions |

A tenant that is already connected to another KAOP account is refused. To use Teams from two KAOP
accounts, you need two tenants.

## Bot or webhook-only

You choose the mode on the first screen of **Integrations → Microsoft Teams**.

* **Bot — two-way chat.** You register your own Azure Bot. People chat with agents in Teams, replies
  land in the thread, and decision buttons work.
* **Webhook only.** You create a Teams Workflows webhook on one channel. Agents post cards there,
  and nothing comes back.

Webhook-only still posts notification cards, and runs still record which Teams tenant they touched.
It gives up the following:

| Not available in webhook-only | What happens instead |
| - | - |
| Replies and routing | Nothing a person writes in Teams reaches an agent. |
| Decision buttons | The card links to the KAOP console, where the decision is made. |
| Identity linking | No Teams user is mapped to a KAOP user. |
| Agent reads of channels and threads | Agents cannot read a Teams channel or thread. |
| In-place message edits | Each progress update is a new post, not an edit of the first one. |

In bot mode, Microsoft delivers every Teams message to KAOP over public HTTPS. On KAOP's hosted
service that needs nothing from you. If Microsoft cannot reach your KAOP install from the internet,
use webhook-only.

## Connect the bot

**1. Create the Entra app and its client secret**

The bot is a **single-tenant** Entra app in your own tenant. Azure no longer creates
multi-tenant bots, and the bot's tokens come from your tenant.

```bash theme={null}
az ad app create --display-name kaop-teams --sign-in-audience AzureADMyOrg --query appId -o tsv
az ad app credential reset --id <app-id> --display-name kaop --years 2
```

The second command prints the three values KAOP asks for:

| Output | KAOP field | Notes |
| - | - | - |
| `appId` | **Microsoft App ID** | The Application (client) ID, a GUID. Not the Object ID. |
| `password` | **Client secret** | The secret's *Value*, not its *Secret ID*. |
| `tenant` | **Directory (tenant) ID** | A GUID, never a domain name. It cannot be changed after you connect. |

Record the secret's expiry date. When it expires, the bot stops working until you paste a new one.

**2. Create the Azure Bot**

Register an Azure Bot on the same app and add its Microsoft Teams channel:

```bash theme={null}
az bot create --resource-group <rg> --name <bot-name> --app-type SingleTenant \
  --appid <app-id> --tenant-id <tenant-id>
az bot msteams create --resource-group <rg> --name <bot-name>
```

Leave the messaging endpoint empty. You copy it from KAOP in the next step.

**3. Connect Teams in KAOP**

Open **Integrations**, pick **Microsoft Teams**, then **Bot — two-way chat**. Enter the
**Microsoft App ID**, **Client secret** and **Directory (tenant) ID**.

Once the App ID is a valid GUID, the form shows a **Messaging endpoint** and a **Download Teams
app package** button. Copy the endpoint into the Azure Bot (**Settings → Configuration →
Messaging endpoint** in the Azure portal), or set it from the CLI:

```bash theme={null}
az bot update --resource-group <rg> --name <bot-name> --endpoint <messaging-endpoint>
```

Download the app package and keep the zip for the next step.

**4. Save and test**

Save the connection, then run **Test**. A passing test means Entra ID issued the bot a token. The
result also says whether agents can read message history; see
[Microsoft Graph permissions](#microsoft-graph-permissions).

**5. Install the Teams app**

The app package holds the Teams manifest and two icons, built for your Microsoft App ID and
messaging endpoint. Install it one of two ways:

* **For the organization.** In the Teams admin center, **Teams apps → Manage apps → Upload new
  app**, then make it available to the people and teams who will use it. An app setup policy
  that installs it for users also puts it in each person's personal scope, which
  [identity linking](#link-teams-identities) needs.
* **Sideload, for a test.** In Teams, **Apps → Manage your apps → Upload an app → Upload a custom
  app**. This needs **Upload custom apps** allowed for you in the Teams app setup policy, and
  custom apps allowed in the org-wide app settings.

Then add the app to each team or group chat where agents should listen. The bot reads only teams
it is installed in.

**6. Send the bot one message**

Teams tells KAOP where to post replies only when the first message arrives. Until someone in the
tenant has messaged the bot, it cannot post anywhere, notification sinks included.

### Updating the installed app

Teams updates an installed app only from a package with a higher version than the one installed.
KAOP raises the package version whenever the package changes. To update, download the package again
from the connection, then:

* **Installed for the organization:** in the Teams admin center, open the app under **Teams apps →
  Manage apps** and upload the new zip with **Upload file**. The app keeps its availability, setup
  policies and the teams it was added to.
* **Sideloaded:** in Teams, **Apps → Manage your apps**, find the app, and choose **Update** with the
  new zip.

A team or chat owner may be asked to consent again when an update requests new resource-specific
consent permissions.

## Resource-specific consent

The app manifest requests two resource-specific consent (RSC) permissions. A team or chat owner
grants them when they add the app.

| RSC permission | Type | Why |
| - | - | - |
| `ChannelMessage.Read.Group` | Application | The bot receives every message in the channels of a team it is added to, not only @mentions. |
| `ChatMessage.Read.Chat` | Application | The same, for a group chat it is added to. |

Without RSC, the bot sees only messages that @mention it in a channel. Keyword and channel-wide
routing rules are refused, and only mention rules work.

KAOP learns that RSC is granted when the bot first receives a message that does not mention it. A
keyword or channel-wide rule is refused until someone has posted one ordinary message in a channel
where the app is installed.

## Route messages to agents

Routing rules decide which Teams messages reach which agent or incident workflow, as they do for
[Slack](https://docs.komodor.com/manage-your-agents/run/channels.md). Teams channels cannot be listed from the console, so you
paste them instead:

* Paste the channel's link (**⋯** on the channel → **Get link to channel**), or its raw
  `19:…@thread.tacv2` id. Links to a chat, meeting, message or team are refused, and so is a link
  from another tenant.
* A **mention** rule fires when someone @mentions the bot, and always works.
* **Keyword** and **channel-wide** rules need [RSC](#resource-specific-consent).

## Microsoft Graph permissions

Agents read Teams through Microsoft Graph with the bot's own credential. These are optional
**application** permissions on your Entra app (**API permissions → Add a permission → Microsoft Graph
→ Application permissions**), and each needs **Grant admin consent** from a tenant admin.

| Graph permission | What it enables | If you skip it |
| - | - | - |
| `User.ReadBasic.All` | Agents resolve a Teams user id to a name. | Agents see user ids, not names. |
| `ChannelMessage.Read.All` | Agents read channel threads and history, and a run started from a thread gets the thread as context. | With the next row missing too: agents see only the triggering message and their own replies, and an incident started from a thread does not read the alert in the thread's parent. |
| `ChatMessage.Read.All` | The same, in group chats. | As above. Both are needed; with only one, history stays off. |

`ChannelMessage.Read.All` and `ChatMessage.Read.All` are protected APIs: Microsoft must approve your
app for them before an admin can consent. See
[Protected APIs in Microsoft Teams](https://learn.microsoft.com/graph/teams-protected-apis).

Even with these grants, an agent reads only channels of teams where the app is installed, and group
chats. One-to-one chats are never read. Reads are bounded to a recent history window, at most 50
messages per page.

KAOP picks up a grant or a revocation within a day. Run **Test** on the connection to check now; the
result says whether agents can read message history, and names any missing permission.

## Link Teams identities

KAOP maps each Teams user to a KAOP user, so runs are attributed to a person and approvals are
checked against that person's permissions.

The first time an unlinked user messages the bot, they get a connect card in a one-to-one chat with
the bot. They select it, sign in to KAOP, and stay linked until the link is removed. The bot can open
that chat only when the app is installed for that person in personal scope, which an org-wide or
policy-pushed install does and a team-only install does not. Without it, the user gets a reply in the
thread asking them to message the bot directly.

Until a user links, their messages do not start a run, and their decision-button presses are refused,
because an approval must name the person who decided. A linked user also needs the **Approve agent
actions** permission to answer a paused action.

## Send notifications to Teams

A [notification sink](https://docs.komodor.com/manage-your-agents/run/outbound-webhooks.md) sends run, agent and incident events
to Teams as Adaptive Cards. Create one under **Integrations → Notification sinks**, choose
**Microsoft Teams**, and pick a delivery:

* **Workflows webhook** — the default, and the only choice in webhook-only mode. In Teams, open the
  channel's **Workflows** and choose **Post to a channel when a webhook request is received**, then
  paste the URL it gives you. The URL must be `https://` on a host under `api.powerplatform.com`,
  `logic.azure.com` or `webhook.office.com`. It is stored as a secret and not shown again.
* **Connected Teams bot** — bot mode only. Paste each channel's link or id. The sink shows the
  channel's name and warns you when the bot has not been added to that channel yet. Cards posted as
  the bot are updated in place, and people can reply in their thread.

The delivery cannot be changed after the sink is created; to switch, create a new sink.

### Incident results

A **Deliver** step in an incident pipeline can target a Teams channel. It posts as your connected
bot, so it needs bot mode, and progress updates edit the first post rather than adding new ones.
Interactive incident cards, such as an approval waiting on a person, go only to a **Connected Teams
bot** sink subscribed to `incident.approval_needed`. A Workflows-webhook sink gets a plain card that
links to the console.

An incident raised from a Teams message shows **Raised in** *Microsoft Teams · channel name* on its
detail page, with a link back to the message.

## Retention and disconnecting

* **Run history.** A request sent from Teams, its thread and the agent's answer stay in the account's
  run history while the app is installed and the connection exists.
* **Agent reads.** What agents read from Teams is removed from a run 30 days after that run. The
  request, the answer and the other steps stay.
* **Uninstalling.** When the app is removed from the last team, group chat and personal scope it was
  installed in, KAOP revokes the tenant's connection, and 14 days later strips the Teams content from
  that tenant's runs. Removing the app from one team while it stays in another changes nothing.

To disconnect, open the Microsoft Teams connection under **Integrations** and choose **Disconnect**.
This removes the connection and its stored client secret, and the bot stops answering; the console
first lists what depends on the connection. Then remove or block the app in the Teams admin center,
and delete the client secret (or the app registration) and the Azure Bot in Azure. For webhook-only,
delete the notification sink and turn off the Workflow in Teams.

## Teams compared with Slack

* **No per-message bot name or icon.** Every post shows the bot's name and icon from the app package.
* **No reactions.** The bot does not react to messages to show progress.
* **No slash commands.**
* **No private replies in a channel.** A reply to a button press shows under the card, visible to the
  whole conversation.
* **No channel picker.** Paste a channel's link instead.

## Troubleshooting

### Connection test

| Message | Cause | Fix |
| - | - | - |
| *Entra ID refused the sign-in* (AADSTS 7000215) | Wrong client secret, often the Secret ID pasted instead of the Value. | Paste the secret's Value. |
| *The client secret for this application has expired* (AADSTS 7000222) | The secret expired. | Create a new secret and update the connection. |
| *Entra could not find application … in tenant …* (AADSTS 700016) | The Object ID was pasted instead of the Application (client) ID, the app is in another tenant, or it was created less than a minute ago. | Paste the Application (client) ID from the same tenant, or test again. |
| *Entra ID (commercial cloud) does not know tenant …* (AADSTS 90002) | An Azure Government or Azure China tenant. | Not supported. |
| *… is not a tenant Entra ID recognises* (AADSTS 900023) | The tenant ID is wrong. | Paste the Directory (tenant) ID GUID. |
| *A Conditional Access policy in this tenant blocked the sign-in* (AADSTS 53003) | A Conditional Access policy applies to the app. | Exclude the app from the policy. |

Saving a connection fails with a conflict when the tenant is already connected to this account or
another one, and is rejected when the App ID or tenant ID is not a GUID.

### Messages do not arrive

| Symptom | Cause | Fix |
| - | - | - |
| The Azure Bot's channel health shows **401** from the endpoint | The Azure Bot's App ID differs from the connection's **Microsoft App ID**, or the request did not come from Teams. Azure's **Test in Web Chat** always gets 401, because KAOP accepts only Teams traffic. | Make the two App IDs the same, and test from Teams. |
| Messages are accepted but nothing happens | No KAOP account has connected this tenant. | Check the connection's **Directory (tenant) ID**. |
| The bot sees only @mentions, or a keyword rule is refused | RSC was not granted, or no ordinary message has reached the bot yet. | Re-add the app and accept its permissions, then post one ordinary message in the channel. |
| The bot does not reply, and a sink does not post | Nobody in the tenant has messaged the bot since install, or the bot is not in that channel. | Message the bot, and add the app to the channel's team. |
| Users are asked to message the bot directly instead of getting a connect card | The app is not installed for them in personal scope. | Install the app org-wide or push it with an app setup policy. |
| A decision button answers *Connect your KAOP account … before answering a paused action* | The person has not linked their Teams identity. | [Link it](#link-teams-identities), then press again. |
| Agents cannot read threads | Graph permissions are missing or not yet picked up. | Grant them, then run **Test**. |
| Teams refuses the zip as an update | The zip has the same version as the installed app. | Download the package again. If its version still matches, there is nothing to update. |

## All Microsoft permissions

| Permission | Kind | Required? | Why |
| - | - | - | - |
| Single-tenant Entra app and client secret | App registration | Bot mode | The bot's identity; its tokens authenticate posts to Teams and reads from Graph. |
| Azure Bot with the Microsoft Teams channel | Azure resource | Bot mode | Delivers Teams messages to the messaging endpoint. |
| `ChannelMessage.Read.Group` | RSC, application | Optional | Hear every channel message, not only @mentions. |
| `ChatMessage.Read.Chat` | RSC, application | Optional | Hear every group-chat message. |
| `User.ReadBasic.All` | Graph, application, admin consent | Optional | Show agents people's names. |
| `ChannelMessage.Read.All` | Graph, application, protected, admin consent | Optional, with the next row | Let agents read channel threads and history. |
| `ChatMessage.Read.All` | Graph, application, protected, admin consent | Optional, with the previous row | Let agents read group-chat history. |
| Teams custom app upload | Teams app policy | Bot mode | Install the app package. |

## Next steps

> [card] [Outbound webhooks](https://docs.komodor.com/manage-your-agents/run/outbound-webhooks.md)
>
> Notification sinks, the event catalog, and delivery behaviour.

> [card] [Channels](https://docs.komodor.com/manage-your-agents/run/channels.md)
>
> Routing rules and channel status, shown for Slack.

> [card] [Integrations](https://docs.komodor.com/manage-your-agents/build/connections)
>
> The connection catalog and testing a connection.

> [card] [Roles & permissions](https://docs.komodor.com/security-and-governance/identity-and-access/roles-permissions.md)
>
> Who can manage integrations and approve agent actions.


## Related topics

- [Channels](https://docs.komodor.com/manage-your-agents/run/channels.md)
- [Integrations list](https://docs.komodor.com/manage-your-agents/build/built-in-integrations.md)
- [Outbound webhooks](https://docs.komodor.com/manage-your-agents/run/outbound-webhooks.md)
- [Roles & permissions](https://docs.komodor.com/security-and-governance/identity-and-access/roles-permissions.md)
- [What's new](https://docs.komodor.com/reference/changelog.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.