When consent is granted for an application, three things may happen:
- A service principal (servicePrincipal) representing the identity of the client application (the one being given access) is created, if it didn't already exist.
- For every API to which the client application is granted delegated permissions, a delegated permission grant (oauth2PermissionGrant) is created.
- For every app-only permission client application is granted, a app role assignment* (appRoleAssignment) is created.
(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?"
- To list all service principals in the tenant:
GET https://graph.microsoft.com/v1.0/servicePrincipals
- To get all tenant-wide delegated permissions granted to a given service principal:
GET https://graph.microsoft.com/v1.0/oauth2PermissionGrants
?$filter=clientId eq {id} and consentType eq 'AllPrincipals'
- To get all app roles (app-only permissions) granted to a service principal:
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