Is Azure Active Directory Consent Cached? - azure

We're building a native application that makes use of Azure AD. The application requires some permissions (like read user profile, execute Azure Service Management API etc.).
When a user uses our application the very first time, they are asked to sign in and once they sign in, they are presented with the consent screen (they grant consent to our application). Once the user grants the consent, they can see our app in their Azure AD (under "Applications" tab). So far so good.
Now what this user does is removes our application manually from their Azure AD (again by going under "Applications" tab). Based on our understanding of the consent model, what this means is that the user has removed the consent to our application.
Now when this user signs in into our application, what we are expecting is that the user is presented with a consent screen again (like the 1st time). However the actual behavior is that the user is not presented with such screen and user is simply signed in into our application. Furthermore, when the user goes back into their Azure AD, they don't see our application in the list of consented apps.
So my questions are:
Does Azure AD somehow cache the consent?
If the consent is cached, for how long is this consent cached?
If the consent is cached, is there a way to for us to clear this consent programmatically or otherwise?
Any insights into why is this happening would be highly appreciated.

In Azure Active Directory, user consent is registered as a link between a User Object and a Service Principal Object representing the client application.
This link is represented in the AAD Graph API as an OAuth2PermissionGrant
You said this:
Now what this user does is removes our application manually from their
Azure AD (again by going under "Applications" tab). Based on our
understanding of the consent model, what this means is that the user
has removed the consent to our application.
I want to clarify. As you might know, when you create a new AAD Application, you need to keep in mind the difference between an Application Object and a Service Principal.
Very specifically, if you delete the Service Principal representing the client application, all of the consent links connected to that Service Principal will be destroyed, thus effectively removing consent. The same cannot be said if you only remove the Application Object, which is likely where you are running into issues.
I explain here the easiest steps required to revoke consent for an Azure Active Directory Application. Let me know if this helps.

Related

How to change calender entries in one tenant using App registered another tenant

We are currently building an headleass application (without front end). This app has to be run as deamon and need to update calander entries of user in different tenant.
We have our seperate Azure subscription where we have created a VM and hosting app. we have different Azure AD tenant thatn the target tenant. I was thinking of registrating the app in our tenant as multi-tenant app. But then I am not sure how it will authorise to change resurces in another tenant.
Or it is must for app to be registered in target tenant?
One of the most important thing is we dont want interactive admin consent flow, as we want everything to be an automatic process. None of the document explains the significance of tenant ID in authentication flow. Anybody knows anything ?
First, you need to create a multi-tenant application in the original tenant, and then grant the application the Calendars.ReadWrite application permission.
Next, run admin consent url in the browser, and then you need to log in with another tenant's administrator account and consent. The multi-tenant application will then be added to the target tenant as an enterprise application. https://login.microsoftonline.com/{tenant-id}/adminconsent?client_id={client-id}.
At the same time, the application will have the Calendars.ReadWrite application permission in the target tenant. Finally, you only need to use the client credential flow to obtain the token and then call the Update calendar api to change the calendar entry of another tenant.

Microsoft Multi Tenant App as an Individual Developer - Azure Active Directory

I am trying to make a multi-tenant application using Microsoft active directory but found out that you need a MPN ID to do so. However, it seems that you can't sign-up for the Microsoft Partner Network as an Individual Developer and you instead need to be a registered business. Is there anyway to create a multi-tenant application as an individual? I'm assuming something like this must exist akin to how you can publish iOS apps as an individual developer.
When you said "multi-tenant application", it means you need to own an AAD tenant to create it.
I assume that you are already an individual developer registered to Microsoft. What you need to do is Create a new tenant in Azure Active Directory. Sign into https://portal.azure.com/ with your individual account to do the above operations.
Please note that your account is a personal account currently, you need to follow the the guidance the portal shows (if it shows) to convert it to a work account as well and then you can create the tenant.
After that you can create multi-tenant application in Azure AD.
Select one of the options to make it as multi-tenant app.
UPDATE:
"Starting November 9th, 2020 end users will no longer be able to grant consent to newly registered multitenant apps without verified publishers" alert means normal user cannot do user consent but admin still can do admin consent.
You need to do the admin consent for custom's tenant by using admin consent (see this answer). It doesn't matter that if they don't do the admin consent before using your application. When the first time an admin from other tenant tries to sign into your application, he will be required to do admin consent as well.
Please refer to auth code flow to learn about the authentication process. Using /common or /organizationare both OK.

Why the user needs to request admin approval in Azure Single Sign On after he is added to users list?

I created an SSO application in the azure portal. As a global administrator I signed to my application with sso and I'm able to fetch the access token and graph details.
In our organization we need to allow few users to use this application. So I added their emails to the 'Users and Groups' in Azure portal. So When the users signed in,they allowed the consent permissions and then the below window appears. May I know the reason?
Is this normal or any kind of bug from side?
Is this window appear everytime once the user got approval ?
Please help me to solve this as I am going through a tough time.
It is not a bug and it is Admin Consent. You as a global
Administrator need to approve the concern from azure AD.
This window will appear only once and it will not appear once user log-in after consent next time.
Please go through Ms Document which has information of configuring Admin Consent.
It seems you are trying to use application permissions, since both shown permissions do not require admin consent for delegated permissions scenarios.
You can read about permission types at https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#permission-types
If you want to review the configuration of your application you can turn to Azure AD. On page https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/CallAnAPI/appId/YOURAPPID/isMSAApp/ (replace YOURAPPID with your app id) you should see something similar to this:
If you at (1) have any of type "Application", these will require admin consent.
Regardless of whether you have any of such, you (required admin privileges) can grant application consent for the tenant using the button at (2).

User account does not show application assignments

Log into Azure B2C
Click Users
Select a user
Click Applications
I created users in my B2C tenant by logging into my website using various OAuth identity providers. So for any user selected using the above steps I expect to see at least one application listed - that being the one the user signed into when their user record was created in Azure.
When I perform the above steps I only see applications listed under my own user name. I created all the users I see in my tenant so I know there should be apps listed with each user name.
More formally stated my questions are:
Given an Azure AD Application, how do I get a list of users that are authorized to log into that app?
Given an Azure AD User, how do I get a list of applications that user is authorized to log into?
I would like to accomplish the above tasks using Azure portal - I don't want to write script. Also, my purpose in asking these questions is to be able to delete or disable users as needed.
Azure AD B2C does not hold a mapping of Users who signed into an App to a specific Application Registration. By default, all users are authorized to sign into your apps if you have OAuth IdPs configured against the AAD B2C policy that allows authentication to your App.
You can use the AAD B2C Sign In logs to see which users have been logging into what applications.
Assigning or not assigning Users to Apps in the Azure Portal does not enforce any authorization, this is an Azure AD only concept and doesnt apply to Azure AD B2C.
The process you followed(Users->select user->application) will only be able to see the applications listed under your tenant.
In the same manner when you choose an application and select the users/Groups you will only be able to see the users who have accessed your application.
Based on application/user->application you can remove the access from that application.
Regarding the
Given an Azure AD Application, how do I get a list of users that are
authorized to log into that app?
Given an Azure AD User, how do I get a list of applications that user
is authorized to log into?
The list of users/application authorized details are completely depend on the application consent flow.
Application developers can dictate what types of permissions are being requested and if they want to guide users through the user consent flow or the admin consent flow. If the application is provided with user consent flow based on the consent acceptance any user can access that particular application.
Admin consent flow is when an application developer directs users to the admin consent endpoint with the intent to record consent for the entire tenant. Application access grant to the requested data on behalf of the entire tenant.
For more details on the consent and permission please go through the document

Azure Active Directory Login: Web App Permissions, User Consent not triggered

I have currently set up a AAD instance and I am authenticating my users against it via my web app, and it’s working great.
When I added and configured the application on AAD, I added the required Application and Delegated Permissions to access the Office365 Calendar API. However, the only thing that is missing is that during the login flow users aren’t being prompted to grant consent for the permissions, as it should happen from what I’ve read in your docs: https://msdn.microsoft.com/en-us/library/azure/dn132599.aspx#BKMK_Consent
I’m not sure what I’m missing. Apparently, from the docs,
After the user has signed in, Azure AD will determine if the user
needs to be shown a consent page. This determination is based on
whether the user (or their organization’s administrator) has already
granted the application consent. If consent has not already been
granted, Azure AD will prompt the user for consent and will display
the required permissions it needs to function. The set of permissions
that is displayed in the consent dialog are the same as what was
selected in the Permissions to other applications control in the Azure
Management Portal.
So maybe somehow I have already probably implicitly granted admin consent for those permissions, but I don’t know how that happened.
I've attached the permissions I configured on the AAD App.
Any help would be appreciated.
If an admin creates an application in their tenant using the AUX portal (manage.windowsazure.com), and requests permissions to other applications, then users in that same tenant are pre-consented for that application. Note this behavior is NOT true for our other App Registration Portals (portal.azure.com or identity.microsoft.com)
I believe this is why you are not seeing the consent dialogue when user's in your tenant are signing into your application. If you would like to push the consent dialogue experience, there are a few different things you can do:
You can use query strings to prompt "consent" or "admin_consent" during login. Check here: https://msdn.microsoft.com/en-us/library/azure/dn645542.aspx
You can delete the service principal for your application from your tenant using AAD PowerShell. You can learn how to do that here: https://msdn.microsoft.com/en-us/library/azure/dn194113.aspx
You can have a user from another tenant try to login to your multi-tenant application.
You can create your application under a non-admin account.
I hope this helps!
Shawn Tabrizi
Try this:
What is the Resource parameter in Windows Azure AD tenant application oAuth 2.0 specification
Changing the resource parameter to https://graph.windows.net did the trick for me.
Furthermore, Microsoft support suggests disabling all permissions except "Enable sign-on and read users' profiles", apparently to avoid permission related problems. I understand that this is not a solution in your case, but at least it gives you a test case.

Resources