Azure AD restrict users to login if not assigned to aplication without user assignement - azure

We want to use Azure AD as the authentication mechanism for our project. To do that, in our organization Azure AD, i have registered an application for our project, added the SPA redirect URI. Added the internal users into the same enterprise application by using Add Users/Groups. Since the frontend app is based on React, we are using #azure/msal-react for authentication and using org AD tenatid and the respective clientid in authConfig.js file with scope as User.Read. Here i am using loginRedirect to start the login process on load of application.
As we are using org Azure AD, there are other applications as well created by other developers. I want to restrict login of other internal users to access this application. I was trying to use User Assignment required as Yes to achieve that, but in that case it is asking for "Need Admin Approval" which we don't want. As for big organization, Global Admin/Application Admin/Cloud Admin will be in different timezone and user shouldn't wait to get the approval from them.
So is there any way i can restrict other internal users to access the application and show them unauthorized page when trying to access the application. Only allocated users would be able to login to the application.
Please suggest. If you need anymore info, please let me know.
Thanks in advance.

To get rid of "Need Admin Approval" screen, please follow below steps:
Make sure you have "Global Admin Role" to change user settings in Azure active directory.
Go to Azure Portal -> Azure Active Directory -> Go to Enterprise Applications -> Click on User Settings -> Admin Consent Requests. Set ‘Users can request admin consent to apps they are unable to consent to’ to “No”.
Make sure to Grant admin consent for the required api permissions you added to your application.
After granting it, it should be like below:
I have tried in my environment, I was able to login to the application without waiting for Admin approval.
AFAIK, to restrict other internal users to access the application and show them unauthorized page when trying to access the application try making use of conditional access policies.
To know how to do that in detail, Make use of below references:
https://learn.microsoft.com/en-us/azure/active-directory/conditional-access/howto-conditional-access-policy-block-access#create-a-conditional-access-policy
c# - iOS authentication with Azure AD - Stack Overflow.

Related

Need Admin Approval Azure App with Allow User Consent Enabled

I've created a web app using asp.net core and I'm trying to authenticate with Azure AD. I've created the app registration and hooked everything up. I'm able to log in fine but when anyone else tries they get the "Need admin approval" message.
My app doesn't require any API permissions and my org has Allow User Consent for Apps enabled. Any ideas on why I would still be getting this error message? I've read all the other posts I could find on this and they didn't seem to be quite the same. This is single tenant only, no api permissions needed.
Here is how I'm setting it up in the web app services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"));
Edit:
Crap, didn't read them all apparently. Answer in this post was my issue as well. I had Assignment required enabled, turning it off allowed users to sign in. Is there no way to have users consent and require assignment?
We can follow the below workaround :-
We must need global administrator role to turn on the admin consent workflow
Then Navigate to Enterprise application>User Settings>Admin consent(select yes)> Save.
For complete setup please refer the below links:-
MICROSOFT DOCUMENTATION:- Enable the admin consent workflow
BLOG:- How to grant admin consent to applications in Azure

Azure SSO- How to remove approval required screen after sign in

I want to add Azure AD auth for my custom SPA. I have registered the app in the app registration in the Azure portal.
When I call this "APP" using APIs I am able to get the login screen and MFA but after logging in to the Azure account I am getting Approval required screen and I want to get rid of this, what should I do?
To get rid of Approval required screen after signing in, user settings of your app have to be changed. Only the admin with Global Administrator role of the tenant can do that. So, make sure to have that role.
Note the client_id of your app that can be found in your Overview tab.
Create an adminconsent URL like this:
https://login.microsoftonline.com/common/adminconsent?client_id=your_client_id
Now, access this URL in the browser and it asks you to pick the azure account.
Select the account with Global Administrator role.
Now, a consent prompt will appear where you have to accept the permissions.
Go to Azure Portal -> Azure Active Directory -> Enterprise Applications -> User Settings -> Admin Consent Requests.
Set ‘Users can request admin consent to apps they are unable to consent to’ to “No”
By this, when the user tried to access the application using authorization API, they won’t get ‘Approval Required’ page anymore that disables all future admin consent operations.
For more information, go through below links.
References:
Disable approval required consent in Azure - Microsoft Q&A
Disable approval required consent in Azure - Stack Overflow

Azure AD app Need admin approval error: App needs permission to access resources in your organization that only an admin can grant

We have an Azure AD app used for authenticating to APIs. We use permissions like offline_access, openid, profile, User.Read etc. and have granted admin consent already. This has been working since 1 year without any issues. In this week, we received 4-5 external users complaining about the error:
Need admin approval
App needs permission to access resources in your organization that
only an admin can grant. Please ask an admin to grant permission to
this app before you can use it.
It is not related to a particular external user from a particular organization, some other user from the same organization don't get this error.
This error occurs only for new external users, we haven't yet received any issues from existing external users.
Admin granted admin consent again after reported error but the users still get the same error message.
I went through few other questions with same error. But since the configuration has been working since past year I am bit confused. During this period we have had lot of external users without any issue.
What configuration should I check to resolve this? Or is there any update in Azure AD default settings?
Check if the Allow users to consent to apps accessing company data on
their behalf is set to No in Enterprise Application Users settings.
If it set to No then please toggle it to yes . This option lets users
decide by themselves if they want to grant access to a given app to
everyone in their organization.
From Microsoft’s official documentation: If this option is
set to yes, then users may consent to allow applications which are
not published by Microsoft to access your organization’s data, if
the user also has access to the data. This also means that the
users will see these apps on their Access Panels. If this option
is set to no, then admins must consent to these applications before
users may use them.
Check if the Allow users to request admin consent to apps they are
unable to consent to is set to No.
If it is set to No then toggle it
to yes as well. If your organization decides that users indeed must
have explicit approval, this option makes it easy for those users to
request approval.
To enable this option, click on User settings (same
as in the previous stem) and then toggle Admin consent requests to
“Yes”. Make sure to Save your changes, which may take a few minutes
to propagate.
From Microsoft Documentation: If this option is set to yes,
then users request admin consent to any app that requires access to
data they do not have the permission to grant. If this option is
set to no, then users must contact their admin to request to consent
in order to use the apps they need.
Note : If this Setting is done from your APP tenant , Please also check the external users tenant as this needs to be done from their
side as well as while trying to use the app, your app will retrieve
user profile etc. from the users tenant .
Add Priority Matrix as an Enterprise Application (org-wide)
if your
AAD administrator decides that everyone in your organization should
get access to Priority Matrix, they can follow these steps:
From the
“Enterprise Applications” view, click on All Applications
Select +
New Application to set up Priority Matrix with Azure AD
authentication
Search “Priority Matrix” and proceed to configure the
app with AD authentication
Note: If you still face the issue please reach out to Azure support engineer to get assisted support by clicking on (Help+support)
and creating a technical support request as it may need live troubleshooting.
Please note that, Consent phishing attacks are highly emerging these days. So, as an admin, we should think about granting permissions to users consent to other applications into our Office 365. You can refer the blog manage user consent to apps to know the ways to approve the applications that users requested.
Also, please don't get upset about the existing applications that were approved by user without your concern. You can now review the permissions granted to apps in office 365 and take remediations immediately if you find an unnecessary application.

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).

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