az login command failure

1.8k Views Asked by At

Trying to set up Azure CLI on my Kali Linux. This is the version of kali.

kali@kali:~$ uname -a
Linux kali 5.5.0-kali2-amd64 #1 SMP Debian 5.5.17-1kali1 (2020-04-21) x86_64 GNU/Linux

After installation, when I run az login, it takes me to the browser where I enter required credentials that are accepted, and the browser then shows following message.

You have logged into Microsoft Azure!

However, in the shell window, it shows the following error.

kali@kali:~$ az login
You have logged in. Now let us find all the subscriptions to which you have access...
The command failed with an unexpected error. Here is the traceback:
                                                                                                                                                           
'SubscriptionClient' object has no attribute 'config'
Traceback (most recent call last):                                                                                                                         
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 215, in invoke                                                                                  
    cmd_result = self.invocation.execute(args)                                                                                                             
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init_.py", line 654, in execute                                                          
    raise ex                                                                                                                                               
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init_.py", line 718, in _run_jobs_serially                                               
    results.append(self._run_job(expanded_arg, cmd_copy))                                                                                                  
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init_.py", line 711, in _run_job                                                         
    six.reraise(*sys.exc_info())                                                                                                                           
  File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise                                                                                       
    raise value                                                                                                                                            
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init_.py", line 688, in _run_job                                                         
    result = cmd_copy(params)                                                                                                                              
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init.py", line 325, in __call_                                                         
    return self.handler(*args, **kwargs)                                                                                                                   
  File "/usr/lib/python3/dist-packages/azure/cli/core/_init_.py", line 782, in default_command_handler                                                   
    return op(**command_args)                                                                                                                              
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/profile/custom.py", line 152, in login                                                    
    subscriptions = profile.find_subscriptions_on_login(                                                                                                   
  File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 195, in find_subscriptions_on_login                                               
    subscriptions = subscription_finder.find_through_authorization_code_flow(                                                                              
  File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 849, in find_through_authorization_code_flow                                      
    result = self._find_using_common_tenant(token_entry[_ACCESS_TOKEN], resource)                                                                          
  File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 893, in _find_using_common_tenant                                                 
    client = self._arm_client_factory(token_credential)                                                                                                    
  File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 812, in create_arm_client_factory                                                 
    configure_common_settings(cli_ctx, client)                                                                                                             
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/client_factory.py", line 79, in configure_common_settings                                   
    client.config.enable_http_logger = True                                                                                                                
AttributeError: 'SubscriptionClient' object has no attribute 'config'                                                                                      

To open an issue, please run: 'az feedback'

What does this error mean and how can this be addressed?

1

There are 1 best solutions below

0
On

honestly this looks like a version mismatch on the libraries you are using? I'd probably remove az cli completely and remove all the python modules that are related to azure and reinstall it, alternatively, just use a docker image with az cli provided by microsoft:

docker run -it mcr.microsoft.com/azure-cli