Create AzureAD app registration when web app is deployed - azure

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.

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.

Related

Secure azure App Service using AD framework 4.5

i have a question about securing access to azure App Services, i have two App services,
App service 1 and App service 2, my App service 1 is basically call my App service 2 , my App service 2 should be secured and allow access only from App Service 1 , i did used Ip Adress restrictions but my client said that its not enough so my question what can i use else to secure that access. the framework used here : 4.5. i did some search about Managed identities and Azure active directory but i dont know if i'm following the right path or not.
thanks for helping.
You could register two AD Apps in Azure AD, one for client-app, and one for backend-app.
In Azure AD, grant permissions to allow the client-app to call the backend-app.
Register an application in Azure AD to represent the API
Register another application in Azure AD to represent a client application
Grant permissions in Azure AD
You can also refer to this doc - Scenario: Protected web API.

Can't find my registered Azure AD Applications

I am trying to configure multi-tenant authentication with Azure App Service in order to enable multi-tenant authentication for my application. I'm following this tutorial: Consume multi-tenant enterprise APIs secured with Azure AD in SharePoint Framework. But I got stuck while I'm configuring Authentication / Authorization settings.
Any help would be greatly appreciated!
Please refer to Configure your App Service app to use Azure Active Directory login to configure an Azure App to use Azure AD as a authentication provider. While selecting an existing app on express settings you need to make sure the app is registered within your tenant. You can also refer to How to Get to the Keys/Secrets From Azure Active Directory to get the keys/secrets from Azure AD for an Enterprise Application.

Azure AD application Model

I'm wondering about the different types of applications.
What I understand:
If I add an application via app registration an application object and an service principal is created
If I consent to an application, only a service principal is created in my tenant , which is a copy of the application object.
If i understand the screenshot correctly only a service principal appears in my tenant.
However, the fact is if i add an gallery app like twitter i get both i can also open and modify the manifest file like it is "my" application.
For me it looks like im getting also a copy of the application object which source is the app gallery directory as mentioned here:
https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-how-applications-are-added
Is this the general case when using apps from the gallery?
Can somebody give some insights on that whats happening in the background?
The Gallery Application is not same as Multi-tenant App which are usually used for Azure B2B.
If I add a gallery App, it will be registered in my tenant and created in my tenant as App for a single-tenant App (Expect it is Native App and it's default a multi-tenant App).
For Multi-tenant App:
It is developed and registered from one organization, If the owner make it to multi-tenant, it just need to be created as a Service principal in other tenant. Also, the owner of this multi-tenant App can use it for Azure AD B2B and can control who can access it, NOT any tenant can use it. The following dig is for Multi-tenant App:
For Gallery App :
It has been developed and published by 3rd party and NOT registered for multi-tenant to let the user's tenant use it. Any AAD tenant can add it and use it .
It means that you can add a Gallery App into your tenant and use it for your own tenant. Not like use a Multi-tenant which has been pre-configured from another tenant. For your tenant, it’s a new Application. So, it will also be registered in your Tenant.
Hope this helps!

Azure AD authentication without app registration

I want to access Azure Directories and Subscriptions using my web app hosted on my server but i do not want to register my app in active directory because
i do not have permissions to register my app in active directory
I want to authenticate users from out of my active directory too.
for example following sites let you authenticate any Azure AD user.
https://resources.azure.com/
https://azureiotsuite.com
Please help me to where to start. i have tried Azure AD authentication but it asks you to register your app in Azure AD Apps.
One option is to register your app at https://apps.dev.microsoft.com. (And use the v2 endpoints)
Documentation here: https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-appmodel-v2-overview
What you want to make is known as a multi-tenant application. An application to which you can login from any Azure AD tenant.
The first link leads you to create a converged app which allows you to use Microsoft accounts as well as Azure AD accounts to sign in.
If you only want Azure AD accounts, you could just create an Azure AD and register the app there as a multi-tenant app. (And use the v1 endpoints)

Can I create an Azure AD registered multi-tenant application that can access OneDrive for Business data on both cloud only tenants and on-prem farms?

I'm creating a multi-tenant application on Azure AD that needs access to OneDrive for Business for both cloud tenants and on-prem farms. Here is my scenario:
My application makes REST calls using the SharePoint 2013 REST API.
The scenario or class of the app is "Daemon/Server Application to Web API".
My app needs needs app-only permissions since the application runs at a scheduled time without user interaction.
Based on the class of app I'm building and the permissions I need, I'm using the Client Credentials Oauth 2.0 flow to allow app-only authentication. The admin running my app gives consent for the tenant once for the app, and then the app is allowed to run on it's own thereafter.
Everything works fine for accessing data on the cloud-only tenants, but I'm not sure if it's possible to also access data for on-prem farms that don't have a tenancy in Azure AD.
Note, I was able to make a SharePoint app that was able to access both, but SharePoint apps don't allow for apps with app-only permissions that grant full-control to a tenant on the fly, so I have to go the Azure AD application route because full control can be granted to apps on the fly.

Resources