azure-cli: az login fails: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf8 in position 10: invalid start byte

Describe the bug

Command Name az login

Errors:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-_1mlo87m\azure-cli-core\azure\cli\core\_profile.py", line 1200, in _get_authorization_code_worker
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\socketserver.py", line 453, in __init__
    self.server_bind()
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\http\server.py", line 138, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\socket.py", line 673, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf8 in position 10: invalid start byte

Login failed

My computer has in no way an exotic or esoteric name. It has the humble name “thebeast” 😉

To Reproduce:

Steps to reproduce the behavior:

  • Ïnstall latest (2.3.1) Azure CLI using MSI (or PowerShell, this fails, too)
  • Execute the command: az login

Expected Behavior

A brower opens for enabling me to login.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.6.6
Installer: MSI
azure-cli 2.3.1

Additional Context

Please note that both

az login -u _username_
az login -u _username_ -p _password_

successfully logs in.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Ah - that makes perfectly sense, actually.

So saving it without BOM makes Windows puke and with BOM Python pukes. Better not put anything needing UTF8 inside it, it seems 😉

Seriously! Thanks for the help!

Oh my! You are a genius.

I did have some 127.0.01 domain names in there. One of them with an international character… Doh!

After removing that, az login works flawlessly!