Reputation: 123
I want to use AAD for PowerBI Rest API and thus need to get Token for auth. Even the permission granted to App does not need Admin consent yet, I always receive a popup saying:
<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.
App API Permissions (see no where it requires Admin consent)
Code I am using for auth:
var userAuthnResult = authenticationContext.AcquireTokenAsync(
ProgramConstants.PowerBiServiceResourceUri,
ProgramConstants.ClientID,
new Uri(ProgramConstants.RedirectUri),
new PlatformParameters(PromptBehavior.Auto)).Result;
P.S I have tried auth. using creds which is not working for me due to multi-factor auth on my org.
var userAuthnResult = authenticationContext.AcquireTokenAsync(
ProgramConstants.PowerBiServiceResourceUri,
ProgramConstants.ClientID,
userCreds).Result;
Upvotes: 0
Views: 1090
Reputation: 14336
If your organization has disabled or restricted users' authorization to consent to applications, you won't be able to grant consent yourself, even if the permissions your app is requesting don't require admin intervention.
You can check if user consent is enabled or disabled in your organization in the Azure portal > Azure AD > Enterprise apps > User settings. (Even if you're not an administrator, you should be able to see if the switch it on or off.)
Upvotes: 1