Solved: az CLI commands not working without sudo in Linux/ubuntu

Anshul Jain
1 min readMay 27, 2021
Photo by Sai Kiran Anagani on Unsplash

Are you facing PermissionError: [Errno 13] Permission denied: ‘/.azure’ while executing az CLI commands?

This issue could be caused due to incorrect user ownership for the files/directories under the /.azure directory.

To fix the issue follow the below steps:

  1. Check for the ownership of the file/ directory for which you are getting the permission denied error
ls -l /home/linxUsername/.azure

After executing the above command, you will see the ownership of the directory and files under it. If the owner is not the current user, you have found the issue.

2. To fix the issue update the Ownership of the directory or file for which the current user is not the owner using the below command.

sudo chown -R user /home/linxUsername/.azure

As the user is the owner of the directory /.azure and files under it.
Now all your az CLI commands will run without sudo.

--

--

Anshul Jain

Software Engineer | Microsoft Azure | Machine Learning