question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get-access-token failed

See original GitHub issue

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug It failed when getting access token: az account get-access-token --q accessToken -o tsv If it fails by design, is it possible to fail elegantly?

(‘Connection aborted.’, OSError(“(104, ‘ECONNRESET’)”,)) Traceback (most recent call last): File “/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 603, in urlopen chunked=chunked) File “/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 387, in _make_request six.raise_from(e, None) File “<string>”, line 2, in raise_from File “/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 383, in _make_request httplib_response = conn.getresponse() File “/opt/az/lib/python3.6/http/client.py”, line 1331, in getresponse response.begin() File “/opt/az/lib/python3.6/http/client.py”, line 297, in begin version, status, reason = self._read_status() File “/opt/az/lib/python3.6/http/client.py”, line 258, in _read_status line = str(self.fp.readline(_MAXLINE + 1), “iso-8859-1”) File “/opt/az/lib/python3.6/socket.py”, line 586, in readinto return self._sock.recv_into(b) File “/opt/az/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py”, line 309, in recv_into raise SocketError(str(e)) OSError: (104, ‘ECONNRESET’)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/opt/az/lib/python3.6/site-packages/requests/adapters.py”, line 449, in send timeout=timeout File “/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 641, in urlopen _stacktrace=sys.exc_info()[2]) File “/opt/az/lib/python3.6/site-packages/urllib3/util/retry.py”, line 368, in increment raise six.reraise(type(error), error, _stacktrace) File “/opt/az/lib/python3.6/site-packages/urllib3/packages/six.py”, line 685, in reraise raise value.with_traceback(tb) File “/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 603, in urlopen chunked=chunked) File “/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 387, in _make_request six.raise_from(e, None) File “<string>”, line 2, in raise_from File “/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 383, in _make_request httplib_response = conn.getresponse() File “/opt/az/lib/python3.6/http/client.py”, line 1331, in getresponse response.begin() File “/opt/az/lib/python3.6/http/client.py”, line 297, in begin version, status, reason = self._read_status() File “/opt/az/lib/python3.6/http/client.py”, line 258, in _read_status line = str(self.fp.readline(_MAXLINE + 1), “iso-8859-1”) File “/opt/az/lib/python3.6/socket.py”, line 586, in readinto return self._sock.recv_into(b) File “/opt/az/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py”, line 309, in recv_into raise SocketError(str(e)) urllib3.exceptions.ProtocolError: (‘Connection aborted.’, OSError(“(104, ‘ECONNRESET’)”,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/opt/az/lib/python3.6/site-packages/knack/cli.py”, line 215, in invoke cmd_result = self.invocation.execute(args) File “/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py”, line 654, in execute raise ex File “/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py”, line 718, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File “/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py”, line 711, in _run_job six.reraise(*sys.exc_info()) File “/opt/az/lib/python3.6/site-packages/six.py”, line 703, in reraise raise value File “/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py”, line 688, in _run_job result = cmd_copy(params) File “/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py”, line 325, in call return self.handler(*args, **kwargs) File “/opt/az/lib/python3.6/site-packages/azure/cli/core/init.py”, line 545, in default_command_handler return op(**command_args) File “/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/profile/custom.py”, line 75, in get_access_token creds, subscription, tenant = profile.get_raw_token(subscription=subscription, resource=resource, tenant=tenant) File “/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py”, line 655, in get_raw_token tenant_dest) File “/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py”, line 1056, in retrieve_token_for_service_principal token_entry = sp_auth.acquire_token(context, resource, sp_id) File “/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py”, line 1156, in acquire_token return authentication_context.acquire_token_with_client_credentials(resource, client_id, self.secret) File “/opt/az/lib/python3.6/site-packages/adal/authentication_context.py”, line 179, in acquire_token_with_client_credentials return self._acquire_token(token_func) File “/opt/az/lib/python3.6/site-packages/adal/authentication_context.py”, line 128, in _acquire_token return token_func(self) File “/opt/az/lib/python3.6/site-packages/adal/authentication_context.py”, line 177, in token_func return token_request.get_token_with_client_credentials(client_secret) File “/opt/az/lib/python3.6/site-packages/adal/token_request.py”, line 310, in get_token_with_client_credentials token = self._oauth_get_token(oauth_parameters) File “/opt/az/lib/python3.6/site-packages/adal/token_request.py”, line 112, in _oauth_get_token return client.get_token(oauth_parameters) File “/opt/az/lib/python3.6/site-packages/adal/oauth2_client.py”, line 268, in get_token timeout=self._call_context.get(‘timeout’, None)) File “/opt/az/lib/python3.6/site-packages/requests/api.py”, line 116, in post return request(‘post’, url, data=data, json=json, **kwargs) File “/opt/az/lib/python3.6/site-packages/requests/api.py”, line 60, in request return session.request(method=method, url=url, **kwargs) File “/opt/az/lib/python3.6/site-packages/requests/sessions.py”, line 533, in request resp = self.send(prep, **send_kwargs) File “/opt/az/lib/python3.6/site-packages/requests/sessions.py”, line 646, in send r = adapter.send(request, **kwargs) File “/opt/az/lib/python3.6/site-packages/requests/adapters.py”, line 498, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: (‘Connection aborted.’, OSError(“(104, ‘ECONNRESET’)”,)) To Reproduce

Expected behavior

Environment summary

az version is 2.5.1 Additional context

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
arrownjcommented, Jun 9, 2020

Hi @feiyushi , this is a very low level exception which is raised by urllib3. Usually it is because that there are some physical problems which cause the failure of socket connection setup.

It’s a good idea to catch the ConnetionError and show a common message to end users. We will consider to add this in our future release. Thanks for reporting.

0reactions
yungezzcommented, Oct 28, 2020

hi @arrownj @houk-ms any update?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to get access token - how to solve related issues - Opster
This guide will help you check for common problems that cause the log ” Failed to get access token ” to appear. To...
Read more >
Getting error while get access token? - Microsoft Q&A
I am trying to get access token for outlook calendar api using "https://login.microsoftonline.com/your_tenant/oauth2/v2.0/token" api but, ...
Read more >
CloudShell get-access-token error - Failed to connect to MSI
Describe the bug When requesting an access token from admin.microsoft.com az cli fails. Command Name az account get-access-token Errors: ...
Read more >
failed to get access token.connection failed | Community
hi,I'm trying to restore VM to AZURE and then I get the following message, anyone know maybe why?
Read more >
message output "Exception: Failed to get access token 400
Hi, I'm yuta. I want to use the quickstart API . https://developers.refinitiv.com/refinitiv-data-platform/refinitiv-data-platform-apis/quick ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found