Skip to content

AzureCliCredentials throws an exception on invalid data when parsing the token in Windows #18664

Description

@yogilad
  • Azure.Identity:
  • 1.5.0:
  • Windows 10:
  • 3.9.2:
  • Microsoft Azure Cli version 2.0.80

Describe the bug
When trying to obtain a token using AzureCliCredential I get an error saying the token returned from Az is invalid.
Issue seems to lie in some extra characters of unknown origin.

Example of token produced by the library call to account get-access-token
8th line has an ESC char followed by some unknown characters

{
  "accessToken": "eyJ********",
  "expiresOn": "2021-05-12 14:58:55.021835",
  "subscription": "7a7b5559-58af-401a-b543-61b7321a97ea",
  "tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47",
  "tokenType": "Bearer"
}
**�[0m**

To Reproduce
Hard to say why this fails. Code is basically

self._kusto_uri = "https://kusto.kusto.windows.net"
self._az_auth_context = AzureCliCredential()
msi_token = self._az_auth_context.get_token(self._kusto_uri)

Expected behavior
Well, this ought to produce a valid token :)

Screenshots
image

Additional context
None

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Azure.Identityneeds-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