-1

When trying to create a storage account in azure from VS Code's Bash Terminal, I get the following error:

error retrieving default location: The client '' with object id '' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resourcegroups/read' over scope '' or the scope is invalid. 
If access was recently granted, please refresh your credentials.

After successfully logging into Azure using az login, I still get the error.

Joy Wang
  • 39,905
  • 3
  • 30
  • 54
kevin
  • 338
  • 2
  • 13

2 Answers2

0

The error means your logged user account/service principal as mentioned in the error does not have enough permission, to solve the issue, navigate to your subscription in the azure portal -> add it with a role e.g. Contributor like below.

Note: To add the role, your account logged in the portal need to be the Owner or User Access Administrator of the subscription.

enter image description here

Joy Wang
  • 39,905
  • 3
  • 30
  • 54
0

After some time past, I was able to run my bash scripts without issues. I ran AZ login again and changed to my subscription. I did all of this before, but I believe it worked this time because the previous session timed out. Previously when I logged into that session I didn't have the necessary permissions and logging in again without previously logging out did not refresh my permissions.

kevin
  • 338
  • 2
  • 13