Azure-cli: az --version Getting permission denied exception after installing Azure CLI

Created on 21 Aug 2020  路  6Comments  路  Source: Azure/azure-cli

az --version Getting permission denied exception after installing Azure CLI

Describe the bug
I installed Azure CLI's latest version and have been not able to run commands over power shell or command prompt. I tried running as an Admin

C:\WINDOWS\system32> az --version
    Traceback (most recent call last):
      File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-d55550gx\azure\cli\core\_session.py", line 47, in load
      File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-d55550gx\azure\cli\core\_session.py", line 65, in save
      File "codecs.py", line 897, in open
    PermissionError: [Errno 13] Permission denied: 'C:\\Users\\mmodi\\.azure\\az.sess'

    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "runpy.py", line 193, in _run_module_as_main
      File "runpy.py", line 85, in _run_code
      File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-clkvqii1\azure\cli\__main__.py", line 35, in <module>
      File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-d55550gx\azure\cli\core\__init__.py", line 848, in get_default_cli
      File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-d55550gx\azure\cli\core\__init__.py", line 65, in __init__
      File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-d55550gx\azure\cli\core\_session.py", line 61, in load
      File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-d55550gx\azure\cli\core\_session.py", line 65, in save
  File "codecs.py", line 897, in open
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\<User Name>\\.azure\\az.sess'

To Reproduce
Installed Azure CLI and run any command. Ex az login , az --version

Expected behavior
azcommands should run

Environment summary

OS - Microsoft Windows 10 Enterprise (10.0.19041 Build 19041)
Azure CLI Version Installed (latest) -  2.10.1

Additional context

Installation customer-reported question

All 6 comments

installing

@mradulmodi can you run az --version in non-admin mode? You may also try to delete the C:\\Users\\mmodi\\.azure\\az.sess file and rerun the command.

Close due to inactivity. Please try out the above instruction and let us know if the issue still persists.

Hi,

I have this same issue even after deleting the file. Please help

Also have the exact same problem in the cli

@fengzhou-msft

Was this page helpful?
0 / 5 - 0 ratings