question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Using -a switch on aad-app-reg.sh to grant admin consent fails

See original GitHub issue

Running aad-app-reg.sh with the -a switch fails with the error message below. It appears the failure occurs during the granting of the admin consent. The app registration for the API is successfully created, but admin consent is not granted. There is no Swagger UI app created.

Steps to reproduce

  1. Run the script with the following command line: ./aad-app-reg.sh -n aztrehack23 -r https://aztrehack23.eastus2.cloudapp.azure.com/oidc-redirect -a
  2. Observe error message below
  3. In AAD, the API app registration (and enterprise app) are created, but no admin consent is granted.

Bad Request({“ClassName”:“Microsoft.Portal.Framework.Exceptions.ClientException”,“Message”:“Graph call failed with httpCode=BadRequest, errorCode=Request_BadRequest, errorMessage=Application ‘c111e4d6-4b89-4462-8790-9dc7891f9bb4’ is requesting permissions that are either invalid or out of date., reason=Bad Request, correlationId = 1ad6c585-e959-4424-9045-81667e1fd014, response = {"odata.error":{"code":"Request_BadRequest","message":{"lang":"en","value":"Application ‘c111e4d6-4b89-4462-8790-9dc7891f9bb4’ is requesting permissions that are either invalid or out of date."},"requestId":"018a2378-c3db-40e6-ad6d-90d75f19671f","date":"2021-09-09T13:39:29"}}”,“Data”:{},“HResult”:-2146233088,“XMsServerRequestId”:null,“Source”:null,“HttpStatusCode”:400,“ClientData”:{“errorCode”:“Request_BadRequest”,“localizedErrorDetails”:{“errorDetail”:“Application ‘c111e4d6-4b89-4462-8790-9dc7891f9bb4’ is requesting permissions that are either invalid or out of date.”},“operationResults”:null,“timeStampUtc”:“2021-09-09T13:39:29.1748809Z”,“clientRequestId”:“1ad6c585-e959-4424-9045-81667e1fd014”,“internalTransactionId”:“d0201830-422e-4467-98c3-64d5a1deccd1”,“tenantId”:“6c7dbaa5-c725-4e29-a340-123bdf8d0049”,“userObjectId”:“6e41d2a3-ec8f-417d-9fe4-e2f29db038c7”,“exceptionType”:“AADGraphException”}})

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tompaanacommented, Sep 17, 2021

I managed to reproduce the error. I’m not sure about the root cause yet, but I think it might have something to do with the newly created app not being ready. Re-running the script succeeds.

EDIT: Tested by adding sleep before az ad app permission admin-consent ... and it did get rid of the error. Now I just have to find a nice way to poll the status before executing the step to fix the problem.

0reactions
SvenAeltermancommented, Sep 16, 2021

I am a Global Admin in the tenant where this occurred.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected consent prompt when signing in to an application
Many applications that integrate with Azure Active Directory require ... the requested permissions, click on the Grant admin consent button.
Read more >
How to fix the 'Need admin approval' error while trying to sign ...
Choose Permissions from the menu on the left and click the Grant admin consent for <your tenant name> button (Fig. 3.).
Read more >
How to Resolve the Need Admin Approval Error
1. Open the Permissions tab and click Grant Admin consent for %CompanyName% · 2. Log in with O365 Admin credentials and click Accept...
Read more >
Grant Admin-Consent using a Service Principal #11159 - GitHub
I have it run the azure cli command above to grant admin consent, and this fails when I run it on Jenkins, which...
Read more >
Azure AD app Need admin approval error - Stack Overflow
Check if the Allow users to consent to apps accessing company data on their behalf is set to No in Enterprise Application Users...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found