How to add application to Azure AD programmatically without having any initial clientId registered?

663 Views Asked by At

I want to automate application creation in Azure AD (Without using management portal). I also want to establish this using only Graph api (without using PowerShell). I have seen thread where this question is discussed (How to add application to Azure AD programmatically?), but it doesn't exactly do what I need.

Since I need to already have clientId in order to get auth token and call any graph apis, I can't really automate the process of initial app creation. (I am having chicken and egg problem). The work around of leveraging Powershell's clientId to get auth token is great, but I can't use that.

Are there any other options that have been added lately that could help?

Thanks!!

1

There are 1 best solutions below

2
On BEST ANSWER

Unfortunately in order for you to ever authenticate to the Graph API, you will need an existing application identity. Remember that the Graph API is just a resource application registered in AAD, and you need to have a client application in order to get access tokens to any resource.

Based on my knowledge of our future plans with our Application Model and Registration Experiences, I believe it will always be a fundamental requirement to use some sort of 'user-centric' experience to create that first application, which would then subsequently allow you to create more applications. To be more specific here, something like AAD PowerShell or our App Registration/Management Portals.

Think about it this way: If there was such a process, completely independent of a user, that would allow the creation of applications, what would stop malicious individuals from attacking your tenant, or any tenant for that matter? Remember that we have object quotas for our tenants, so someone creating millions of applications in your tenant would block you from being able to create users, groups, etc...

However, there may be some disconnect between what we believe to be valid scenarios, and the real life problems our customers need to solve. Can you help us by telling us more about your specific requirements and restrictions? What is the scenario that drives those factors?