Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix IDW10405 error when using managed identity with common tenant#3415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jmprieur merged 4 commits intomasterfromcopilot/fix-3395
Jul 15, 2025

Conversation

Copy link
Contributor

CopilotAI commentedJul 15, 2025
edited
Loading

Problem

When using managed identity in multi-tenant applications withAzureAd.TenantId set to"common", theGetAuthenticationResultForAppAsync method throws anIDW10405 error:

IDW10405: 'tenant' parameter should be a tenant ID or domain name, not 'common', 'organizations' or 'consumers'.

This occurs becauseResolveTenant is called before checking if managed identity is being used. For managed identity flows, tenant resolution is not needed and should be skipped entirely.

Configuration Example

{"AzureAd": {"TenantId":"common","ClientId":"<app-guid>"  },"DownstreamApis": {"MyApi": {"BaseUrl":"https://example.com","Scopes": ["scope"],"AcquireTokenOptions": {"ManagedIdentity": {"UserAssignedClientId":"<managed-identity-client-guid>"        }      }    }  }}

Solution

Moved theResolveTenant call to execute only for non-managed identity scenarios:

  • Before:ResolveTenant was called unconditionally, causing the error
  • After:ResolveTenant is skipped when using managed identity, preventing the error

Changes

  1. TokenAcquisition.cs: MovedResolveTenant call after managed identity check
  2. TokenAcquisitionTests.cs: Added test case to verify the fix

The fix is minimal and surgical - only 3 lines changed in the core logic while preserving all existing functionality.

Testing

  • Added comprehensive test case covering the scenario
  • Verified existing tenant resolution logic still works correctly
  • Confirmed no regression in non-managed identity flows

Fixes#3395.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn moreCopilot coding agent tips in the docs.

CopilotAIand others added2 commitsJuly 15, 2025 16:25
Co-authored-by: jmprieur <13203188+jmprieur@users.noreply.github.com>
Co-authored-by: jmprieur <13203188+jmprieur@users.noreply.github.com>
CopilotAI changed the title[WIP] [Bug] Getting IDW10405 when overriding acquire token options with managed identityFix IDW10405 error when using managed identity with common tenantJul 15, 2025
Copilot finished work on behalf ofjmprieurJuly 15, 2025 16:30
CopilotAI requested a review fromjmprieurJuly 15, 2025 16:30
@jmprieurjmprieur marked this pull request as ready for reviewJuly 15, 2025 16:45
@jmprieurjmprieur requested a review froma team as acode ownerJuly 15, 2025 16:45
Copy link
Collaborator

@jmprieurjmprieur left a comment

Choose a reason for hiding this comment

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

LGTM

@jmprieurjmprieur merged commit85d5873 intomasterJul 15, 2025
5 checks passed
@jmprieurjmprieur deleted the copilot/fix-3395 branchJuly 15, 2025 18:19
This was referencedJul 21, 2025
This was referencedNov 24, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@bgavrilMSbgavrilMSbgavrilMS approved these changes

+2 more reviewers

@brentschmaltzbrentschmaltzbrentschmaltz approved these changes

@jmprieurjmprieurjmprieur approved these changes

Reviewers whose approvals may not affect merge requirements

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug] Getting IDW10405 when overriding acquire token options with managed identity

4 participants

@brentschmaltz@bgavrilMS@jmprieur

[8]ページ先頭

©2009-2025 Movatter.jp