Assigning application roles to Microsoft Entra ID groups is needed for managing access to enterprise applications and ensuring users have the right permissions. IT admins often need to configure these assignments to streamline role-based access control (RBAC) and enhance security. The New-MgGroupAppRoleAssignment PowerShell command in Microsoft Graph enables admins to assign app roles to groups, though it requires scripting expertise and manual execution.
Before running the New-MgGroupAppRoleAssignment cmdlet, ensure the following requirements are met:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Group.Read.All"
Use the New-MgGroupAppRoleAssignment cmdlet in Microsoft Graph PowerShell to assign app roles to Microsoft Entra ID groups. The syntax is as follows:
New-MgGroupAppRoleAssignment
-GroupId <String>
[-ResponseHeadersVariable <String>]
[-AdditionalProperties <Hashtable>]
[-AppRoleId <String>]
[-CreatedDateTime <DateTime>]
[-DeletedDateTime <DateTime>]
[-Id <String>]
[-PrincipalDisplayName <String>]
[-PrincipalId <String>]
[-PrincipalType <String>]
[-ResourceDisplayName <String>]
[-ResourceId <String>]
[-Headers <IDictionary>]
[-ProgressAction <ActionPreference>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Example: Assign an app role to a Microsoft Entra ID group
New-MgGroupAppRoleAssignment -GroupId "your-group-id" `
-PrincipalId "your-group-id" `
-ResourceId "your-app-id" `
-AppRoleId "your-app-role-id"
The table below lists key parameters that can be used with the New-MgGroupAppRoleAssignment cmdlet to grant app roles to Microsoft Entra ID groups.
| Parameters | Description |
|---|---|
| -AdditionalProperties | This specifies the additional parameters. |
| -AppRoleId | This is the identifier for the app role that is assigned to the principal. |
| -GroupId | This is the unique identifier of the group. |
| -CreatedDateTime | This shows the time when the app role assignment was created. |
| -DeletedDateTime | This shows the date and time when the object was deleted. |