17

I have just created an AKS cluster using a standard az aks create ... --ssh-key-value .... According to https://docs.microsoft.com/en-us/azure/aks/kubernetes-service-principal,

an AKS cluster is created, and because an existing service principal is not specified, a service principal is created for the cluster.

Where can I find the created SP? Thanks

22

As Bruno Faria said, you can find the service principal in Azure Active Directory, Azure Active Directory -> App registrations -> All apps like this:

enter image description here

Also you can use az aks list --resource-group <your-resouece-group> to find your service principal:

enter image description here

Hope this helps.

1
  • This is what we were looking for. How to get the SP assigned to a specific cluster, which is especially relevant if you have several clusters and several non-AKS specific SPs. Thanx
    – JoaoCC
    Feb 12 '18 at 13:35
4

Go to Azure Active Directory >> App Registrations >> Select All Apps from the dropdown menu >> find your app and click on it.

The service principal will be the application Id and the secret will be the key under settings.

2
  • I went there, and there are several apps, none of them with the name of the created cluster. What I was looking to understand is how do I know which of these has been assigned to the newly created cluster. Thx
    – JoaoCC
    Feb 11 '18 at 21:01
  • Well, I just noticed that ~/.azure/acsServicePrincipal.json has service_principalwith the same value as one of the apps' ApplicationID. Curiously, in the portal, this app has a link to Create Service Principal. Is this ok? Thx
    – JoaoCC
    Feb 11 '18 at 21:09
2

The output from "az aks list" should contain your service principal clientId.

1
  • 1
    How does this differ from the accepted answer by @Jason Ye ?
    – Dave M
    Nov 11 '18 at 13:33
1

Try with this

az aks list --resource-group core-project --query="[0].servicePrincipalProfile.clientId"
0

Refer this link for step by step guide for app registration in Azure AD - https://sanganakauthority.blogspot.com/2019/04/how-to-create-service-principal-or-app.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.