I'm creating an AKS cluster through the Azure CLI.
Something like:
az aks create
--resource-group RESOURCE-GROUP
--name "mycluster"
--enable-managed-identity
--network-plugin "azure"
--no-ssh-key
...
After creation I get a managed identity mycluster-agentpool. I have added to that identity the "Network Contributor" role to the Resource group where the PublicIP is located. I waited over an hour.
But I still get this error from the nginx service:
network.PublicIPAddressesClient#List: Failure responding to request: StatusCode=403 --
Original Error: autorest/azure: Service returned an error.
Status=403
Code="AuthorizationFailed"
Message="The client '00000000-0000-0000-0000-00000000' with object id '00000000-0000-0000-0000-00000000' does not have authorization to perform action
'Microsoft.Network/publicIPAddresses/read' over scope
'/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/RESOURCE-GROUP/providers/Microsoft.Network' or the scope is invalid.
If access was recently granted, please refresh your credentials."
What I find strange is that after creating the cluster and query the "identity":
az aks show -g RESOURCE-GROUP -n mycluster --query "identity"
I get (sample GUIDs):
{
"principalId": "00000000-1234-1234-1234-00000000",
"tenantId": "00000000-5678-5678-5678-00000000",
"type": "SystemAssigned",
"userAssignedIdentities": null
}
And this principalId doesn't match with the ObjectId of the mycluster-agentpool identity, and I cannot find anywhere to what it belongs, because I suspected the principalId was the identity that needed the rights.
With what identity is the nginx service trying to connect?