Alexander Schmidt
Alexander Schmidt

Reputation: 5733

Create AzureAD app registration when web app is deployed

I understand the concept of AzureAD App Registrations and I'm using it in several projects. Now I need to generate a Web App that should be deployable as a component in any AAD. This Web App should use Azure APIs to discover components in the subscription it is deployed to which I don't know at develop time.

What is the preferred way to accomplish the app registration fully automated at deploy time? I need to register an app in AAD and then to store the informations (App Id, Tenant ID, ...) in my web.config somehow.

Upvotes: 0

Views: 119

Answers (1)

RasmusW
RasmusW

Reputation: 3471

The problem is that you can't develop an app that has access to the Azure AD without it being registered first.

The Azure Portal and Powershell have access. Maybe you can use Powershell to script the permission grant in your scenario?

Otherwise, (I did this a while back for a solution) you can create a multi-tenant web app, that your customers' Azure AD tenant administrators can sign in to. With the tenant administrators granting access, the web app can then access their Azure AD graph API and create the required application definition for your application.

In my scenario the Azure AD client application ran on-premise. It required access to the Azure AD graph API and also needed certificate based authentication towards the Outlook 365 Exchange Web Service. So the web app could create the certificate, grant access to the required APIs, and let the user download the certificate, application ID etc. The on-prem app could then use the downloaded file as its configuration for accessing the Azure AD and other APIs.

Upvotes: 1

Related Questions