Least-privilege roles
Do not grantContributor on the whole subscription. Scope the service principal to what Ankra does:
Grant
Network Contributor on the resource group of the virtual network too when the subnet lives elsewhere. If you would rather not grant resource-group creation at the subscription, create the group yourself and name it at cluster creation (aks.resource_group); Ankra adopts it and never deletes it.
Before you start
- A role in Ankra with
credentials.write(the built-inownerandadminroles have it). See Credentials. - Permission in Microsoft Entra ID to create an application and assign roles on the subscription and resource groups.
Creating an Azure credential
1
Create the service principal
appId (client ID), password (client secret) and tenant. The secret is shown once - store it in a secret manager, not in a shell history or a ticket.2
Assign the roles
3
Store it in Ankra
- Portal
- CLI
Go to Integrations & alerts → Credentials, click Add credential, and under Cloud providers choose Microsoft Azure. Enter a Name (3 to 100 lowercase letters, digits and single hyphens; it cannot change later), the Subscription ID, Tenant ID, Client ID and Client secret.Click Test the connection. You see The connection works. Then click Add credential; Ankra validates the principal again before storing it, and the credential’s page opens.
Rotating the secret
- Create a new secret on the application in Microsoft Entra ID.
- In Ankra, open the credential, click Settings & access, and under Replace the secret enter the New client secret (and the New client ID if you moved to another application; leave a field empty to keep it). Click Check and replace.
- When you see The secret is replaced, delete the old secret in Entra ID.