azure-cli: az login --identity gives errors: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

$ az login --identity
bash: /anaconda/envs/jupyter_env/lib/libtinfo.so.6: no version information available (required by bash)
The command failed with an unexpected error. Here is the traceback:
Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/profile/custom.py", line 122, in login
    return profile.login_with_managed_identity(username, allow_no_subscriptions)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/_profile.py", line 234, in login_with_managed_identity
    msi_creds = MSIAuthenticationWrapper(resource=resource)
  File "/opt/az/lib/python3.10/site-packages/msrestazure/azure_active_directory.py", line 592, in __init__
    self.set_token()
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/auth/adal_authentication.py", line 75, in set_token
    super().set_token()
  File "/opt/az/lib/python3.10/site-packages/msrestazure/azure_active_directory.py", line 596, in set_token
    self.scheme, _, self.token = get_msi_token_webapp(self.resource, self.msi_conf)
  File "/opt/az/lib/python3.10/site-packages/msrestazure/azure_active_directory.py", line 548, in get_msi_token_webapp
    token_entry = result.json()
  File "/opt/az/lib/python3.10/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/opt/az/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/opt/az/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/az/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az login

Errors:

Paste here the error message you have received. Make sure to remove all sensitive information,
such as user name, password, credential, subscription ID, etc.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here…
  • az login --identity

Expected Behavior

Environment Summary

Linux-5.15.0-1031-azure-x86_64-with-glibc2.31, Ubuntu 20.04.5 LTS
Python 3.10.8
Installer: DEB

azure-cli 2.45.0

Extensions:
ml 2.14.0

Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1

Additional Context

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

Below solution worked for me:

  1. After opening Azure Machine learning Studio, go to Notebooks.

  2. Open any jupyter notebook or create a new jupyter notebook.

  3. Once inside a Jupyter notebook file, at the top (Shown in image) Azure will ask to “Authenticate”. Click on “Authenticate” button and that will log you in. image

  4. Then you can open Azure Terminal and perform “az login --identity”.