Skip to content

AzureCliCredential fails due to Python deprecation message getting mixed with token output #26857

@micromaomao

Description

@micromaomao
  • Package Name: azure-identity
  • Package Version: 1.10.0
  • Operating System: WSL
  • Python Version: 3.6.0

Describe the bug
In https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/azure/identity/_credentials/azure_cli.py#L137, the option "stderr": subprocess.STDOUT makes check_output also include stderr in the returned string. I was trying to use this package in a container with a somewhat out-of-date python setup, which caused az account get-access-token to output some warnings to stderr:
RequestsDependencyWarning from python screenshot

Since _run_command's return value is parsed as JSON, this caused an exception and resulted in a somewhat confusing error message:

azure.core.exceptions.ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials.
...

To Reproduce
(Environment-specific, but reasoning for this issue described above)

Expected behavior
AzureCliCredential should work

Metadata

Metadata

Labels

Azure.IdentityClientThis issue points to a problem in the data-plane of the library.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-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 team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions