Using the AzureAD module, I can retrieve all delegated permissions for a service principal using the Get-AzureADServicePrincipalOAuth2PermissionGrant
cmdlet. However, I can't find a similar cmdlet to retrieve the application permissions for a service principal in this module.
Does the AzureAD module provide a way to retrieve application permissions for a service principal?
Application permission assignments are represented as appRoleAssignments in the directory. Literally assigning a role to the app's service principal.
With the V2 module:
There are two ways to approach getting the roles.
What permissions have been assigned to principal A?
Here I am getting what app permissions have been assigned to this principal.
Who has permissions on principal A?
Here the object id is for Microsoft Graph. It lists out all principals who have been assigned any app permissions on it.
Either way you still get a list of AppRoleAssignments.
You will need to join the assignments with the right roles yourself. You can print out the app roles e.g. MS Graph offers quite easily:
Example: