ClientAuthenticationError by using VisualStudioCodeCredential
See original GitHub issue- Package Name: azure-identity
- Package Version: 1.8.0
- Operating System: Windows 10
- Python Version: 3.8
Hello,
I tried to use VisualStudioCodeCredential
from azure-identity in combination with the Azure Account VScode extension.
It worked for a while but now a ClientAuthenticationError
is raised.
Here is the traceback:
File "C:\foo\lib\site-packages\azure\storage\blob\_shared\policies.py", line 489, in send
response = self.next.send(request)
File "C:\foo\lib\site-packages\azure\core\pipeline\_base.py", line 71, in send
response = self.next.send(request)
File "C:\foo\lib\site-packages\azure\core\pipeline\_base.py", line 71, in send
response = self.next.send(request)
File "C:\foo\lib\site-packages\azure\core\pipeline\policies\_authentication.py", line 117, in send
self.on_request(request)
File "C:\foo\lib\site-packages\azure\core\pipeline\policies\_authentication.py", line 94, in on_request
self._token = self._credential.get_token(*self._scopes)
File "C:\foo\lib\site-packages\azure\identity\_credentials\vscode.py", line 152, in get_token
return super(VisualStudioCodeCredential, self).get_token(*scopes, **kwargs)
File "C:\foo\lib\site-packages\azure\identity\_internal\get_token_mixin.py", line 76, in get_token
token = self._request_token(*scopes, **kwargs)
File "C:\foo\lib\site-packages\azure\identity\_credentials\vscode.py", line 163, in _request_token
return self._client.obtain_token_by_refresh_token(scopes, refresh_token, **kwargs)
File "C:\foo\lib\site-packages\azure\identity\_internal\aad_client.py", line 57, in obtain_token_by_refresh_token
return self._run_pipeline(request, **kwargs)
File "C:\foo\lib\site-packages\azure\identity\_internal\aad_client.py", line 76, in _run_pipeline
return self._process_response(response, now)
File "C:\foo\lib\site-packages\azure\identity\_internal\aad_client_base.py", line 135, in _process_response
_raise_for_error(response, content)
File "C:\foo\lib\site-packages\azure\identity\_internal\aad_client_base.py", line 288, in _raise_for_error
raise ClientAuthenticationError(message=message, response=response.http_response)
azure.core.exceptions.ClientAuthenticationError: Azure Active Directory error '(invalid_grant) AADSTS70043: The refresh token has expired or is invalid due to sign-in frequency checks by conditional access. The token was issued on 2021-10-18T18:59:27.4825877Z and the maximum allowed lifetime for this request is 86400.
Trace ID: 635927ad-a3ce-4cd7-b566-cbd3f1482300
Correlation ID: dec74379-a04d-4140-b594-9b7333d130af
Timestamp: 2022-03-20 12:06:45Z'
What can I do about it?
Note that I have no error with an AzureCliCredential
.
Is this related to the following issue? https://github.com/Azure/azure-sdk-for-python/issues/19509
Thanks for your help
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Occassional error authenticating to KeyVault - Microsoft Q&A
ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials. Attempted credentials: ...
Read more >Azure Identity client library for Python - NET
ClientAuthenticationError has a message attribute which describes why authentication failed. When raised by DefaultAzureCredential or ChainedTokenCredential , ...
Read more >DefaultAzureCredential failed to retrieve a token from the ...
Job is failing with exception ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials.
Read more >VisualStudioCodeCredential.get_token failed - Stack Overflow
Not sure why it does not work, it looks correct. If you just want to login with visual studio code, you can also...
Read more >azure-identity - PyPI
Apps using DefaultAzureCredential or VisualStudioCodeCredential can then use this account to ... ClientAuthenticationError when they fail to authenticate.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Blabll Thanks for reaching out.
Could you check the version of the Azure Account extension?
It is a known issue that the latest Azure Account extension does not work well with Azure-identity package.
As a workaround, you can use version 0.9.11 or earlier of the Azure Account extension.
For more information: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md#authenticate-via-visual-studio-code
This is still broken in late September 2022. We downgraded our VSCode extension to 0.9.10 and resolved the issue.