Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Cli giving me permission error when typing "az login"

I have just installed Azure Cli and when I am trying to login to my Azure account using az login it gives me an error -

The error - Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/_session.py", line 48, in load
    with codecs_open(self.filename, 'r', encoding=self._encoding) as f:
  File "/usr/local/Cellar/[email protected]/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/codecs.py", line 905, in open
    file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/mawada14/.azure/azureProfile.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/[email protected]/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/[email protected]/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/__main__.py", line 38, in <module>
    az_cli = get_default_cli()
  File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/__init__.py", line 912, in get_default_cli
    return AzCli(cli_name='az',
  File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/__init__.py", line 80, in __init__
    ACCOUNT.load(os.path.join(azure_folder, 'azureProfile.json'))
  File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/_session.py", line 61, in load
    self.save()
  File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/_session.py", line 65, in save
    with codecs_open(self.filename, 'w', encoding=self._encoding) as f:
  File "/usr/local/Cellar/[email protected]/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/codecs.py", line 905, in open
    file = builtins.open(filename, mode, buffering)
PermissionError: [Errno 13] Permission denied: '/Users/mawada14/.azure/azureProfile.json'
like image 368
Mohamad Awada Avatar asked Nov 29 '25 09:11

Mohamad Awada


1 Answers

I made the following change and it worked

sudo chown -R $USER:$USER $HOME/.azure/

essentially transfering ownership of all files recursively to the current user.

like image 103
dsgou Avatar answered Dec 02 '25 05:12

dsgou