Skip to content

[Bug] WithTenantId request-level override is ignored for consumer tenant #5951

@ssmelov

Description

@ssmelov

Library version used

4.83.3

.NET version

.NET 472, .NET 8.0

Scenario

ConfidentialClient - service to service (AcquireTokenForClient)

Is this a new or an existing app?

None

Issue description and reproduction steps

1 - Setup a ConfidentialClientApplication with app-level authority configured.

2 - Override tenant to consumer tenant at request-level

var builder = confidentialApp
    .AcquireTokenForClient(scopes)
    .WithTenantId("9188040d-6c67-4c5b-b112-36a304b66dad");

3 - Try to acquire a token

var result = await builder
    .ExecuteAsync()
    .ConfigureAwait(false);

4 - request-level authority override is ignored for consumer tenant and app-level authority is used instead for token-acquisition

Relevant code snippets

Expected behavior

A request‑level authority should be honored for the consumer tenant.

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

Respect the request-level authority at CreateAuthorityForRequestAsync for consumer tenant:

if (!requestAuthority.IsCommonOrganizationsOrConsumersTenant() ||

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions