When I try to do az login on my dev machine it will not succeed in Chrome. In edge I need to refresh the browser for the login process to finish. This was also broken 19 days ago so this time I tried and disabled all of my ad/tracker blocking extensions in chrome. However that didn't seem to help.
Command Name
az login
Errors:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
az loginTrying in Google chrome (doesn't work):
Url --
https://localhost:8400/?code=<redacted>&state=<redacted>&session_state=<redacted> <-- If you need redacted values please ask.
In Browser --
This site can鈥檛 provide a secure connection localhost sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR
Trying in edge by changing default browser to edge. (partially works):
D:\un\acr\DevServices-ContainerRegistry-Service\src\ibiza\KraterExtension>az login
Note, we have launched a browser for you to login. For old experience with device code, use "az login --use-device-code"
----------------------------------------
It was stuck on this for about a minute or two and then I decided to refresh the browser, then this happened below. It seemed to proceed to login from there.
Exception happened during processing of request from ('127.0.0.1', 49737)
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\socketserver.py", line 317, in _handle_request_noblock
self.process_request(request, client_address)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\socketserver.py", line 348, in process_request
self.finish_request(request, client_address)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\socketserver.py", line 721, in __init__
self.handle()
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\http\server.py", line 418, in handle
self.handle_one_request()
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\http\server.py", line 386, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
----------------------------------------
You have logged in. Now let us find all the subscriptions to which you have access...
Login works.
Windows-10-10.0.18362-SP0
Python 3.6.6
Shell: cmd.exe
azure-cli 2.0.71 *
This is a typical browser setup issue (possibly enabled by some extensions) where Chrome is forcing traffic through https://localhost:8400. CLI fails because it only works with HTTP.
To remove this HTTPS policy,
chrome://net-internals/#hstsMore info: https://stackoverflow.com/a/28586593/2199657
On top of @jiasli's suggestion, you can use az login --use-device-code to get unblocked meanwhile.
@jiasli

Does deleting localhost from Delete domain security policies solve the issue?
@jiasli Yup that seems to fix it. Closing now. Thanks!
For Edge's hang issue, may be related to #10578.
Most helpful comment
This is a typical browser setup issue (possibly enabled by some extensions) where Chrome is forcing traffic through https://localhost:8400. CLI fails because it only works with HTTP.
To remove this HTTPS policy,
chrome://net-internals/#hstsMore info: https://stackoverflow.com/a/28586593/2199657