Skip to content

[BUG] Upgrading Azure.Identity from 1.12 to 1.14.2 changes claims and breaks auth with AzureDevOps #51401

@eddynaka

Description

@eddynaka

Library name and version

Azure.Identity 1.12

Describe the bug

Hello,

I'm trying to upgrade my Azure.Identity reference from 1.12 to 1.14.2 but I'm seeing some issues when authenticating with AzureDevOps. Here is how I authenticate:

var workloadIdentityCredential = new WorkloadIdentityCredential(new WorkloadIdentityCredentialOptions
{
    ClientId = clientId,
    TenantId = tenantId,
    AuthorityHost = authorityHost,
    AdditionallyAllowedTenants = { tenantFromAccount }
});

string[] scopes = new string[] { $"{Constants.AzureDevOpsResourceId}/.default" };
VssCredentials credentials;
var tokenRequestContext = new TokenRequestContext(scopes, tenantId: tenantFromAccount);
AccessToken token = await workloadIdentityCredential.GetTokenAsync(tokenRequestContext, cancellationToken);

tenantId and tenantFromAccount is being set to tenantIdA but when I print the claims with version 1.12 and version 1.14.2, the property iss shows a different tenant, not the one that I passed, preventing us from authenticating in AzureDevOps.

TLDR:

Expected behavior

That using the snippet above with 1.14.2 to generate the correct iss property from claims (tenantIdA)

Actual behavior

When using version 1.14.2, it generates claims with a different tenantId, preventing the token to be valid.

Reproduction Steps

Use the code above with an application that runs in AKS where the application lives in a given tenant and is allowed to connect into AzureDevOps. Migrate to a recent Azure.Identity package and review claims.

Environment

AKS
.NET 8

Metadata

Metadata

Labels

Azure.IdentityClientThis issue is related to a non-management packagecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

Status

Blocked

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions