'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'
Solution 1:[1]
Delete the C:/users/your-user-name/.azure directory and reinstall Azure cli from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli It works.
Solution 2:[2]
I followed this Microsoft documentation and able to login my azure portal using CLI cmd az login.
For more information please refer the below links:
. Permission denied' error after running 'az login | GitHub.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Constantine |
| Solution 2 |

