Custom Role To Allow Granting Admin Consent to Any App Registration

Jamie Brandwood 131 Reputation points
2024-02-02T13:06:15.9633333+00:00

how can you have users with the Application Administrator role, but also allow them to Grant Admin Consent to any Application Permissions?

My initial plan was to simply create a Custom Role with 'microsoft.directory/servicePrincipals/managePermissionGrantsForAll.microsoft-company-admin' and assign along side the Application Administrator role. But this isn't enough ... 'Grant Admin Consent for ***' is still greyed out.

Appreciate the Privileged Role Administrator role could be granted to allow this, But ideally we would like details of the Role Permissions that would be sufficient to grant just the Admin Consent capability.

If anyone has this level of detail it would be greatly appreciated. Many thanks.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,827 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Marilee Turscak-MSFT 34,631 Reputation points Microsoft Employee
    2024-02-03T00:20:10.2633333+00:00

    @Jamie Brandwood

    The custom directory role needs to include the permission to grant permissions to applications, as noted in the prerequisites. There appears to be a current issue with the Graph Powershell cmdlet and the 'delegated, application' permission type. These need to be included in the app consent policy in order for the user to grant the admin consent. I have reached out to the engineering team to confirm about this issue, as I am also seeing the same behavior and it doesn't appear to be documented. You need to use the following settings to grant both delegated and application consent:

    New-MgPolicyPermissionGrantPolicyInclude     -PermissionGrantPolicyId "Delegate-Consent-AdminPolicy" -PermissionType "delegated "     -PermissionClassification "all" -ClientApplicationsFromVerifiedPublisherOnly:$false
    
    
    New-MgPolicyPermissionGrantPolicyInclude     -PermissionGrantPolicyId "Delegate-Consent-AdminPolicy" -PermissionType "application"     -PermissionClassification "all" -ClientApplicationsFromVerifiedPublisherOnly:$false
    
    

    https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/manage-app-consent-policies?pivots=ms-powershell

    (The current logic expects these to be granted separately, which is why you need the two separate commands.)

    By design the Global admin can see an additional control on the traditional consent prompt that will allow to granting consent on behalf of the entire tenant.  https://learn.microsoft.com/en-us/entra/identity-platform/application-consent-experience#common-scenarios-and-consent-experiences

    When you assign the custom role, you can consent on behalf of a single user by Powershell, workflow consent, or MS Graph. For the app registration you need the additional permissions to Grant Admin consent, but these cannot be added to a custom role by design.

    Users with the "microsoft.directory/servicePrincipals/managePermissionGrantsForAll.microsoft-company-admin" permission should be able to grant admin consent on behalf of all, but it looks like this may only grant permission on behalf of the single user and there is the additional step required to grant the delegated and app permissions in the app consent policy via New-MgPolicyPermissionGrantPolicyInclude .

    Let me know if this helps and I will also update this thread when I have more information from the engineering team. https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/custom-consent-permissions#granting-permissions-to-apps-on-behalf-of-all-admin-consent