Managing Microsoft Entra ID application role assignments is essential for maintaining secure access control across enterprise applications. IT administrators often need to revoke user app role assignments to enforce least privilege access, remove outdated permissions, or comply with security policies. While the Remove-MgUserAppRoleAssignmentPowerShell command in Microsoft Graph allows admins to remove app role assignments from users, it requires scripting expertise and manual execution.
ManageEngine ADManager Plus is an identity governance and administration solution designed to simplify Microsoft Entra ID management and reporting. With advanced management actions and in-depth reports, it optimizes administrative tasks and minimizes IT workload.
Before running the Remove-MgUserAppRoleAssignment cmdlet, ensure the following requirements are met:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "AppRoleAssignment.ReadWrite.All"
Use the Remove-MgUserAppRoleAssignment cmdlet in Microsoft Graph PowerShell to remove app role assignments of Microsoft Entra ID users. The syntax is as follows:
Remove-MgUserAppRoleAssignment
-AppRoleAssignmentId <String>
-UserId <String>
[-IfMatch <String>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-PassThru]
[-ProgressAction <ActionPreference>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Example: Remove a user's application role assignment
Use this Graph PowerShell command to remove a Microsoft Entra ID user's app role assignment.
Remove-MgUserAppRoleAssignment -AppRoleAssignmentID '01B8ir38J0eoiYqyMt_qAVDX9vgSB6xDur4zn5zOluM' -UserId '8a7c50d3-fcbd-4727-a889-8ab232dfea01'
The table below lists key parameters that can be used with the Remove-MgUserAppRoleAssignment cmdlet to remove Microsoft Entra ID users' app role assignments.
| Parameters | Description |
|---|---|
| -AppRoleAssignmentId | This is the unique identifier of the app role assignment. |
| -Confirm | This is to confirm before running the cmdlet. |
| -WhatIf | This shows what would happen if the cmdlet was run. |
| -UserId | This is the unique identifier of a user. |