Skip to content

With "TR-tr" culture set, DAC does not properly convert some values of AZURE_TOKEN_CREDENTIALS to lowercase properly #53510

@christothes

Description

@christothes

DefaultAzureCredentialFactory currently takes the value of the EnvironmentVariables.CredentialSelection and makes it lowecase in order to avoid casing issues.

string credentialSelection = EnvironmentVariables.CredentialSelection?.Trim().ToLower();

However, if current thread culture is Turkish, "AZURECLICREDENTIAL". ToLowerO is equal to "azureclıcredentıal" (notice dotless lowercase 'i'). This creates an invalid value for comparison against the known valid values.

The DefaultAzureCredentialFactory should handle case insensitivity such that other culture settings work without issue.

Repro:

using System.Globalization;
using Azure.Core;
using Azure.Identity;
 
Thread.CurrentThread.CurrentCulture = new CultureInfo("TR-tr");
Environment.SetEnvironmentVariable(DefaultAzureCredential.DefaultEnvironmentVariableName, "AZURECLICREDENTIAL");
DefaultAzureCredential credential = new DefaultAzureCredential(DefaultAzureCredential.DefaultEnvironmentVariableName);
AccessToken token = credential.GetToken(new TokenRequestContext(scopes: ["[https://vault.azure.net/.default"]));
Console.WriteLine($"Access token acquired. Token type: {token.TokenType}, ExpiresOn: {token.ExpiresOn}");

Metadata

Metadata

Labels

Azure.IdentityClientThis issue is related to a non-management packageneeds-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions