DefaultAzureCredentials.get_token invalid response after using az login #37841
Labels
Azure.Identity
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
issue-addressed
Workflow: The Azure SDK team believes it to be addressed and ready to close.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
azure-identity = "^1.19.0"
Ubuntu 20
Python 3.11
I am using DefaultAzureCredentials and i want to use AzureCliCredential. I would like to call get_token() method for BlobStorage and get token for logged user.
This is my very simple code:
credential = AzureCliCredential() token = credential.get_token("https://storage.azure.com/.default") print(token.token)
Before that i am using az login in terminal inside python environment, and i am succesfully logged in.
In azure.identity._credentials.azure_cli.parse_token method i am getting exception due to invalid json.
Azure can see me be logged into, and returns access_token and other stuff but adds some additional
invalid signs at the end of string so it makes string invalid json.
How to get AzureCliCredential working properly?
Exception:
AzureCliCredential: Unexpected output from Azure CLI: '{ ****, "expiresOn": "2024-10-10 19:23:33.461197", "subscription": "proper_value_here", "tenant": "proper_value_here", "tokenType": "Bearer" } '. To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/azclicredential/troubleshoot.
The text was updated successfully, but these errors were encountered: