# Microsoft Teams

Connect Microsoft Teams to Factory and delegate work from channel mentions using your organization's remote delegation configuration.

Mention `@Factory` in a Microsoft Teams channel to have Droid investigate, implement, and test work on a remote computer. Droid posts progress and results in the same thread.

<Info>
  Microsoft Teams remote delegations are in Private Preview. Contact your Factory account team to request access and confirm that Teams delegation is enabled for your organization. Currently, delegation works in channels, not direct messages or group chats.
</Info>

You delegate directly from Teams; you do not need to create a Software Factory automation. The [Remote delegations](/remote-delegations) settings control the shared execution configuration.

A personal [Microsoft Teams connector](/harness/connectors) gives Droid tools to use inside a session. It does not install the Factory app in Teams or enable channel delegation.

## Prerequisites

To connect and configure Teams delegation, you need:

- The **Manager** or **Owner** role in the Factory organization you want to connect.
- Access to **Settings → Remote Delegations**, including Teams app setup.
- Permission to authorize the app for your Microsoft organization and install it in Teams. Your Microsoft administrator may need to approve it.
- Service-account access and an active service account for shared execution.
- An execution template for **Dynamic** compute, or service-account-owned Droid Computers for **Persistent** compute.

Team members who delegate work need a Factory account in the connected organization. Use the same work email in Microsoft Teams and Factory so Factory can match the person making the request.

## Connect and install the app

Linking your Microsoft tenant and installing the app in Teams are separate steps. Complete both before delegating work.

<Steps>
  <Step title="Open Teams delegation settings">
    In Factory, open <a href="https://app.factory.ai/settings/remote-delegations">**Settings → Remote Delegations**</a>. Under **Delegation Apps**, find **Teams** and select **Set Up for Org**.

    If Teams is already connected, select **Configure** to open its setup page.
  </Step>
  <Step title="Authorize your Microsoft organization">
    Select **Connect** on the Teams setup page. Sign in to Microsoft with an account in the tenant you want to connect and complete the consent flow.

    If Microsoft requires administrator approval, ask your Microsoft administrator to approve the app. Check that you are connecting the intended Microsoft tenant to the intended Factory organization.
  </Step>
  <Step title="Finish installation in Teams">
    After authorization, Factory shows **Connected** and opens Microsoft Teams to finish installation. Select **Install App** on the confirmation if Teams does not open automatically.

    Install the app in the team whose channels will receive delegation requests. If the app is blocked or unavailable, ask your Teams administrator to check app availability and policy in the Teams admin center. Your Factory account team can confirm the installation path for your preview.
  </Step>
  <Step title="Verify the connection">
    Return to **Settings → Remote Delegations** and confirm that Teams is connected. In Teams, check that the app is installed in the intended team and available in the channel's mention picker.

    A connected tenant alone does not confirm that the Teams app is installed. Complete the execution configuration below before sending your first request.
  </Step>
</Steps>

## Configure shared execution

In **Settings → Remote Delegations**, find **Remote Delegation Configs** and select **Edit** on **Apps**.

Follow [Configure delegated sessions](/remote-delegations#configure-delegated-sessions) to review:

| Setting | What to configure |
| --- | --- |
| **General** | Default model, reasoning level, and instructions for delegated work. |
| **Plugins** | Plugins that delegated sessions need. |
| **Identity** | An active service account with the required Git credentials and connectors. |
| **Compute** | **Dynamic** with an execution template, or **Persistent** with computers owned by the service account. |

Eligible organizations receive a default configuration, service account, and execution template. Review those defaults to confirm that the environment can access the repositories and tools your task needs.

Teams channel delegations using the Apps configuration run with its **service-account identity, Git credentials, and connectors**, not the sender's personal connections. This configuration is shared with other delegation apps, so changes can affect more than Teams.

Team members can set a preferred model and reasoning level under **Settings → Session Defaults → Delegations**. When organization policy allows it, the requester's model preference overrides the configuration's model. Choose **Org default** to use the configuration's model and reasoning settings. A personal model preference does not change the execution identity or connector access.

## Delegate a task from a channel

1. Open a channel in a team where the app is installed.
2. Start a new post and select `@Factory` from the mention picker.
3. Describe the task, including the repository, desired outcome, and verification steps.
4. Send the message.

For example:

> @Factory In the storefront repository, investigate the failing checkout test. Fix the cause, run the relevant tests, and open a pull request with a summary and test results.

![Microsoft Teams channel message mentioning Factory to investigate elevated rates of 500 errors, with replies in the thread](/docs-assets/images/teams-delegation.png)

<Note>
  Droid receives the message that mentions it, not earlier messages in the channel or thread. Include the relevant context in your request, even when you mention Factory in an existing discussion. Paste important error messages, reproduction steps, and acceptance criteria rather than referring only to "the conversation above."
</Note>

Factory starts a session using the shared configuration and posts status updates in the thread. For code changes, Droid is instructed to open a pull request and return its URL. Review the proposed changes and test results before merging.

## Follow progress and send follow-ups

To continue the task, reply in the same thread and mention `@Factory` again with your instruction. For example:

> @Factory Add a regression test for the empty-cart case, then rerun the checkout tests.

If Droid asks a question, mention it again in that thread with your answer. Teams does not support interactive question forms; if Droid reports that a question stopped the run, send the answer as a new mention to continue.

For shared service-account sessions, only the person who started the delegation can send follow-ups or stop the task. Other channel members can read the replies, but cannot take over that session.

Start a new channel post with a new mention for a separate task. Mentions in an existing delegation thread continue its session.

### Stop a running task

Select **Stop** on the running task's status card in Teams. Use the Teams account that started the delegation.

Stopping does not undo work already performed. Review any changes or pull requests produced before the stop.

## Troubleshooting

<Troubleshooting>
  <TroubleshootingItem title="Teams is missing or disabled in Remote Delegations">
    Confirm that you have the **Manager** or **Owner** role and that your organization has Teams remote delegation access. Teams availability is enabled separately during the preview. Contact your Factory account team if the settings page or app is unavailable. Remote Delegations settings are not available in airgapped deployments.
  </TroubleshootingItem>

  <TroubleshootingItem title="Factory says Connected but the app is not available in Teams">
    The Microsoft consent flow links the tenant; it does not install the app in a team. Finish the Teams installation step and ask your Teams administrator to check that the app is allowed. If the installation link cannot find the app, contact your Factory account team to confirm preview availability.
  </TroubleshootingItem>

  <TroubleshootingItem title="The Microsoft tenant is already linked to another Factory organization">
    Check which Factory organization you selected. If the tenant needs to move, coordinate with a Manager or Owner of the currently connected organization before disconnecting it and linking it to the intended organization.
  </TroubleshootingItem>

  <TroubleshootingItem title="Droid does not respond to my message">
    Use a channel, not a direct message or group chat. Confirm that the app is installed in that team and select Factory from the mention picker rather than typing its name as plain text. Include a task after the mention and use the connected Microsoft tenant.
  </TroubleshootingItem>

  <TroubleshootingItem title="Factory cannot match my Teams account">
    Make sure your Microsoft work email matches your Factory account email and that you belong to the connected Factory organization. Retry the request. If matching still fails, contact Factory support; connecting a personal Teams connector does not establish this account match.
  </TroubleshootingItem>

  <TroubleshootingItem title="Droid asks me to select a computer">
    The shared Apps configuration is not being used for this request. Ask a Manager or Owner to review **Remote Delegation Configs → Apps**, including its identity and compute. Configure shared execution if the team should use a service account rather than personal computer selections.
  </TroubleshootingItem>

  <TroubleshootingItem title="The session cannot start">
    Check that the service account is active and has the required credentials. The execution template must have a ready build, or persistent computers must be online with a current Droid daemon. See [Remote delegations troubleshooting](/remote-delegations#troubleshooting) for compute-policy and capacity errors.
  </TroubleshootingItem>

  <TroubleshootingItem title="My follow-up or Stop action is rejected">
    Use the Teams account that started the delegation. Send follow-ups in the same thread and mention Factory again. To start your own task instead, create a new channel post with a new mention.
  </TroubleshootingItem>
</Troubleshooting>

<RelatedLinks>
  <RelatedLink href="/remote-delegations" title="Remote delegations">
    Configure shared identity, instructions, plugins, and compute.
  </RelatedLink>
  <RelatedLink href="/enterprise/identity-and-access" title="Identity & Access">
    Set up service accounts and Git credentials.
  </RelatedLink>
  <RelatedLink href="/droid-computers/byom" title="Bring Your Own Machine (BYOM)">
    Connect your own computers for persistent execution.
  </RelatedLink>
  <RelatedLink href="/harness/connectors" title="Connectors">
    Give the execution identity access to external tools.
  </RelatedLink>
</RelatedLinks>
