Add test coverage for multi-tenant auth methods and fix regex pattern bug#309
Merged
MattB-msft merged 3 commits intousers/mbarbour/supportMultiTenantMultiInstanceAgentIdfrom Feb 5, 2026
Conversation
…enant_id methods; fix regex bug Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com>
…comment Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update to address review feedback on multi-tenant MsalAuth
Add test coverage for multi-tenant auth methods and fix regex pattern bug
Feb 5, 2026
8aca851
into
users/mbarbour/supportMultiTenantMultiInstanceAgentId
2 checks passed
MattB-msft
added a commit
that referenced
this pull request
Feb 5, 2026
…dd JWT decoding functionality with adaptive card integration (#307) * Enhance MsalAuth for multi-tenant support, update MSAL version, and add JWT decoding functionality with adaptive card integration * Update test_samples/agentic-test/src/agent.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Refactor: Improve regex formatting and comment clarity in MsalAuth class * Add test coverage for multi-tenant auth methods and fix regex pattern bug (#309) * Initial plan * Add comprehensive test coverage for _resolve_authority and _resolve_tenant_id methods; fix regex bug Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com> * Address code review feedback: improve test naming and add clarifying comment Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: MattB-msft <10568244+MattB-msft@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds comprehensive test coverage for
_resolve_authorityand_resolve_tenant_idmethods inMsalAuth, which are critical for multi-tenant authentication but were previously untested.Changes
_resolve_tenant_id: Validates tenant ID resolution logic across scenarios including "common" tenant handling, parameter overrides, and missing configuration error cases_resolve_authority: Validates regex-based tenant replacement in authority URLs, including/commonand GUID replacements, path preservation, and trailing slash handlingr"/\/(?:common|<GUID>)(?=\/|$)/"tor"/(?:common|<GUID>)(?=/|$)"- the extra forward slashes prevented pattern matching entirelyExample
The regex now correctly replaces tenant identifiers:
Added 14 test cases covering tenant resolution scenarios for both methods.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.