Skip to content

Navigation Menu

Sign in
Sign up

Teams connector: support Single Tenant Azure Bot (configurable tenantId) - #2020

Draft
zigzago with Copilot wants to merge 2 commits into
master from
copilot/fix-teams-connector-incompatibility
Draft

Teams connector: support Single Tenant Azure Bot (configurable tenantId) #2020
zigzago with Copilot wants to merge 2 commits into
master from
copilot/fix-teams-connector-incompatibility

Conversation

Copilot AI commented Mar 26, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Since mid-2025, Microsoft deprecated Multi-Tenant Azure Bot creation. New bots are Single Tenant only, requiring {tenantId} (not botframework.com) in the OAuth2 token endpoint — causing 401 failures with all new bot setups.

Changes

  • RetrofitsInterface.kt: Replace hardcoded @POST("/botframework.com/oauth2/v2.0/token") with dynamic @Path("tenantId") parameter
  • TokenHandler.kt: Add optional tenantId constructor param (default: "botframework.com" — preserves multi-tenant behavior)
  • TeamsConnector.kt: Thread tenantId parameter through to TokenHandler
  • TeamsConnectorProvider.kt: Expose optional "Tenant ID" field in Tock Studio connector configuration UI

The token request URL is now:

POST https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token

Existing multi-tenant bots are unaffected — if tenantId is left blank, it defaults to botframework.com.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1.0.17.172.in-addr.arpa
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens java.base/java.lang=ALL-UNNAMED -jar /home/REDACTED/work/tock/tock/bot/engine/target/surefire/surefirebooter-20260326153340334_27.jar /home/REDACTED/work/tock/tock/bot/engine/target/surefire 2026年03月26日T15-33-05_878-jvmRun1 surefire-20260326153340334_25tmp surefire_4-20260326153340334_26tmp (dns block)
  • build.shibboleth.net
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.13/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.13/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.13 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.13/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/tock/tock org.codehaus.plexus.classworlds.launcher.Launcher test -pl bot/connector-teams -q (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.13/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.13/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.13 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.13/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/tock/tock org.codehaus.plexus.classworlds.launcher.Launcher compile -pl bot/connector-teams -am -q (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.13/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.13/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.13 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.13/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/tock/tock org.codehaus.plexus.classworlds.launcher.Launcher test -pl bot/connector-teams -am -q (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Teams connector: incompatibility with Single Tenant Azure Bot (Multi-tenant bot creation deprecated by Microsoft)</issue_title>
<issue_description>## Summary
Since mid-2025, Microsoft has deprecated the creation of Multi-Tenant Azure Bots.
All new Azure Bots must now be created as Single Tenant or User-Assigned Managed Identity.
This makes the Tock Teams connector non-functional for any new bot setup.

Problem

The TokenHandler in the Teams connector requests an OAuth2 token using botframework.com
as the tenant:

POST https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token

This works only for Multi-Tenant bots. For Single Tenant bots, the request must use
the specific Tenant ID instead:

POST https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token

As a result, all token requests fail with HTTP 401.

Steps to reproduce

  1. Create a new Azure Bot (only Single Tenant is available)
  2. Create an App Registration with the corresponding App ID and secret
  3. Configure the Teams connector in Tock Studio with the appId and password
  4. Send a message → no response, 401 error in logs:

WARN ai.tock.bot.connector.teams.TeamsClient - Microsoft Login Api Error : 401

Expected behavior

The Teams connector should support Single Tenant Azure Bots by allowing
the configuration of a tenantId parameter, used in the OAuth2 token request.

Environment

  • Tock version: 25.10.5
  • Connector: Teams
  • Azure Bot type: Single Tenant (Multi-tenant no longer available for new bots)
  • App Registration signInAudience: AzureADandPersonalMicrosoftAccount</issue_description>

<agent_instructions>please suggest a PR to fix the issue</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title (削除) [WIP] Fix Teams connector for Single Tenant Azure Bot compatibility (削除ここまで) (追記) Teams connector: support Single Tenant Azure Bot (configurable tenantId) (追記ここまで) Mar 26, 2026
Copilot AI requested a review from zigzago March 26, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@zigzago zigzago Awaiting requested review from zigzago

At least 2 approving reviews are required to merge this pull request.

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Teams connector: incompatibility with Single Tenant Azure Bot (Multi-tenant bot creation deprecated by Microsoft)

2 participants

AltStyle によって変換されたページ (->オリジナル) /