I have registered an application in azure portal, I need to get the service principal Id using the registered application ID in my javascript application. But I could not find the API to do this job. I try to using azure-graph api, but the list function of ServicePrincipals interface needs a special permission which is not applicable. Is there any easy way to get service principal by application ID and secret?
Asked
Active
Viewed 2,175 times
1 Answers
1
Azure App Client ID is identical to Service Principal ID if you created this app in your tenant. In case of multitenant app more principals will be created since App is 1:many relationship to service principal objects but they will have the same ID too.
Showing azure ad application using CLI
az ad app show --id ""
Showing azure ad service principal using CLI
az ad sp show --id ""

Adam Marczak
- 2,257
- 9
- 20
-
service principal id is different application Id: https://stackoverflow.com/questions/54066287/azure-service-principal-id-vs-application-id. commdnd az ad app show --id "" is show app. for service principal you should use command az ad sp show --id – Frank Wang Aug 30 '19 at 21:42
-
The appId property on the app and sp is the same always, regardless if it's single tenant or not. The objectId of the SP is always a unique id, separate from the objectId of the app object. The objectId is also different in each tenant where the app is registered. – juunas Aug 31 '19 at 08:25