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
Related
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.
When an end-user is accessing their organization data by using my Azure OAuth APP, they are being asked for admin approval, the consent shows the message as "Approval Required", Can anyone will help me out on how to solve this issue so that end-user will not be asked for the admin approval?
Authorization URL we used to authenticate the end-user:- https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&state={{state}}&redirect_uri={{redirect_uri}}&client_id={{client_id}}&resource={{resource}}
[Admin Consent Image]
[1]: https://i.stack.imgur.com/BgZgJ.png
From your application's perspective, you cannot do anything to stop this prompt to appear.
Following are some of the reasons why your users are seeing this prompt:
Your application is asking for some tenant-wide permissions that only an admin can consent to.
The admin has set a policy in Azure AD which blocks users to consent to 3rd party applications like yours.
Only solution to this is to have an admin in the target Azure AD to consent to the application. They can do it by several means:
Manually by logging in into your application (like your users) and consenting to the application.
Granting admin consent to the application by logging in into Azure Portal and then visiting the application's page in Enterprise Applications section.
Visiting the admin consent URL specific for your application.
To learn more, please see this page: https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/grant-admin-consent.
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).
I created an app in azure and authenticating using AAD ,but when users try to log in they keep getting message admin approval required But no matter how I configure the application in the Azure Portal, I'm always receiving the following message after I've logged in with a normal user but an admin can login without the app showing the error,:
My Enterprise applications | User settings
My API permissions
I need my users to just login normally like the admin, what am I doing wrong?
This question has been resolved by #juunas comment, post it as an answer to close the question.
If you are using /common or /organizations as the authority in the
app, the user will authenticate against their home tenant. It might be
what is happening here. Your tenant's settings will not apply there,
and they may be required to give admin consent.
The solution is to set the admin consent to: "Yes"
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.