[BUG] EnvironmentCredential kicks is when environment variables are empty string? #18031
Labels
Azure.Identity
Client
This issue points to a problem in the data-plane of the library.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
Describe the bug
Per the doc for
DefaultAzureCredential
the order of the underlying credentials is the following:What means that if the former kicks-in but fails the the latter would never kick-in and be tried. And that's what apparently happens in our case.
Our service in production is running as a Azure Service Fabric application on VMSS and acquires a token using User-assigned Managed Identity. Locally we're setting the necessary environment variables to mimic the behavior.
Service Fabric application manifest is an XML file that allows to set environment variables to either a value or an empty string. It doesn't allow to set the value to null:
What means that the environment variables are set as empty strings. The
!=
checks in EnvironmentCredential.cs are not enough to skip it altogether.Expected behavior
Token is acquired by ManagedIdentityCredential, not by EnvironmentCredential because it's skipped due to missing environment variables.
Actual behavior (include Exception or Stack Trace)
To Reproduce
TBD
Environment:
dotnet --info
output for .NET Core projects):The text was updated successfully, but these errors were encountered: