Azure- Getting (AuthorizationFailed) even with owner role assigned to my account

87 views Asked by At

When I run az aks get-credentials --name project --resource-group project-rg, I get the following error: enter image description here

but I have owner access level in the resource group: enter image description here

I've tried 1. logging out and logging in. 2. az account set --subscription guid2. 3. checked if I have the right permissions (checked Microsoft.ContainerService/managedClusters/listClusterAdminCredential/action Neither has worked. Any suggestions?enter image description here

Solution- turns out I didn't run the az account set --subscription <guid>

2

There are 2 answers

0
unixcorn On BEST ANSWER

...Turns out I needed to set the cluster subscription using az account set --subscription <guid>

1
Alex On

You would need the specific permission at the cluster level to be able to run the get-credentials command. The permission is: Microsoft.ContainerService/managedCluster/listClusterUserCredential/action

This permission is usually included in the following default roles:

  • Azure Kubernetes Service Cluster User Role
  • Azure Kubernetes Service Cluster Admin Role

If you give yourself one of these permissions, you should be authorised to run the get-credentials command.