Reputation: 1693
As per the title I can't find anywhere that explicitly gives me the information and my best guess was to use
https://graph.microsoft.com/v1.0/applications
and look at the requiredResourceAccess but that doesn't appear to provide the information about actual consent.
Is the mere presence of entries in here proof that admin consent was required, I'm going to guess at no as I added permissions to an app and even before granting consent the entries appeared in requiredResourceAccess and the entries didn't change when I granted consent.
Upvotes: 1
Views: 1922
Reputation: 14326
When consent is granted for an application, three things may happen:
(Depending on which permission the app requires, #2 or #3 might be unnecessary.)
So, "what applications have been granted admin consent?" can be equated to "what service principals exist which have been granted tenant-wide delegated permissions, or app-only permissions?"
GET https://graph.microsoft.com/v1.0/servicePrincipals
GET https://graph.microsoft.com/v1.0/oauth2PermissionGrants
?$filter=clientId eq {id} and consentType eq 'AllPrincipals'
GET https://graph.microsoft.com/v1.0/servicePrincipals/{id}/appRoleAssignments
To map the granted app role IDs or delegated permission scope values to the display names and descriptions, you can look up the granted app roles to the appRoles and oauth2PermissionScopes collections on the resource service principal (i.e. the service principal representing the API).
This can all be done with Azure AD PowerShell and wrapped into a function to dump out delegated and app-only permission grants. Here is an example: Get-AzureADPSPermissions.ps1
Upvotes: 3