Skip to content

Add optional TenantId to AgenticIdentity#583

Merged
heyitsaamir merged 5 commits into
mainfrom
heyitsaamir-agentic-identity-tenant-id
Jun 29, 2026
Merged

Add optional TenantId to AgenticIdentity#583
heyitsaamir merged 5 commits into
mainfrom
heyitsaamir-agentic-identity-tenant-id

Conversation

@heyitsaamir

Copy link
Copy Markdown
Collaborator

Summary

Adds an optional tenant id to AgenticIdentity, mirroring tenant_id in teams.py.

The tenant arrives on the wire as tenantId on the inbound activity's account (alongside agenticAppId / agenticUserId / agenticAppBlueprintId), so the change wires it through end-to-end.

Changes

  • AgenticIdentity — new optional TenantId property; FromAccount now maps it.
  • ChannelAccount — added typed tenantId JSON property (the wire source); GetAgenticIdentity() now populates TenantId. A tenantId alone still does not fabricate an agentic identity.
  • TeamsChannelAccount — removed its duplicate tenantId, now inherited from the base ChannelAccount (same JSON name, no behavior change). Updated the related doc cref in TeamsBaggageBuilder.
  • Tests — added unit tests covering the wire → identity mapping and the tenant-only case.

Verification

  • 169 Core + 354 Apps unit tests pass.
  • Verified live against a real agentic invoke: the recipient's tenantId flowed correctly into the parsed AgenticIdentity.TenantId.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Expose the agentic tenant id end-to-end: add a typed tenantId to the base
ChannelAccount (the wire source), surface it through GetAgenticIdentity and
AgenticIdentity.FromAccount, and add AgenticIdentity.TenantId. The duplicate
tenantId on TeamsChannelAccount is removed in favor of the inherited base
property (same JSON name, no behavior change).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 26, 2026 22:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for propagating an optional tenantId from inbound activity accounts into the strongly-typed AgenticIdentity model, aligning teams.net with the wire format and the corresponding teams.py model.

Changes:

  • Added optional TenantId to AgenticIdentity and mapped it from ChannelAccount.
  • Introduced a typed tenantId (TenantId) property on ChannelAccount and wired it into GetAgenticIdentity().
  • Removed duplicate tenantId from TeamsChannelAccount, relying on inheritance, and added unit tests for tenant mapping and the tenant-only non-identity case.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/test/Microsoft.Teams.Core.UnitTests/Schema/CoreActivityTests.cs Adds unit tests for wire tenantIdAgenticIdentity.TenantId mapping and tenant-only behavior.
core/src/Microsoft.Teams.Core/Schema/ChannelAccount.cs Adds typed TenantId (tenantId) on accounts and includes it in GetAgenticIdentity().
core/src/Microsoft.Teams.Core/Schema/AgenticIdentity.cs Adds optional TenantId and maps it from ChannelAccount.
core/src/Microsoft.Teams.Apps/Schema/TeamsChannelAccount.cs Removes duplicate TenantId property so it’s inherited from ChannelAccount.
core/src/Microsoft.Teams.Apps/Diagnostics/TeamsBaggageBuilder.cs Updates XML doc reference for the tenant fallback comment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/Microsoft.Teams.Core/Schema/ChannelAccount.cs
Comment thread core/src/Microsoft.Teams.Apps/Diagnostics/TeamsBaggageBuilder.cs Outdated
Comment thread core/src/Microsoft.Teams.Apps/Schema/TeamsChannelAccount.cs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@microsoft microsoft deleted a comment from Copilot AI Jun 26, 2026
@heyitsaamir heyitsaamir enabled auto-merge June 26, 2026 23:18
@heyitsaamir heyitsaamir added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit 2f404ba Jun 29, 2026
7 checks passed
@heyitsaamir heyitsaamir deleted the heyitsaamir-agentic-identity-tenant-id branch June 29, 2026 16:19
@heyitsaamir heyitsaamir mentioned this pull request Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants