Managing Microsoft Entra ID group memberships is crucial for maintaining proper access control and security within an organization. IT administrators often need to remove specific users or devices from groups to revoke access or enforce policy changes. While the Remove-MgGroupMemberByRef PowerShell command in Microsoft Graph allows admins to delete group members using direct references, it requires scripting expertise and manual execution.
For a more efficient and user-friendly approach, ManageEngine ADManager Plus, an identity governance and administration solution with comprehensive Microsoft Entra ID management and reporting capabilities, offers a no-code solution. With its intuitive interface and powerful management actions, administrators can seamlessly remove users from Microsoft Entra ID groups, enforce access policies, and maintain security without the complexity of PowerShell scripting.
View the supported LDAP headers that can be specified in the CSV file.
Import the CSV file containing the required data.
Before running the Remove-MgGroupMemberByRef cmdlet, ensure the following requirements are met:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "GroupMember.ReadWrite.All"
Use the Remove-MgGroupMemberByRef cmdlet in Microsoft Graph PowerShell to delete Microsoft Entra ID group members. The syntax is as follows:
Remove-MgGroupMemberByRef
-InputObject <IGroupsIdentity>
[-IfMatch <String>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-PassThru]
[-ProgressAction <ActionPreference>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Example: Delete members of a group
Use this Graph PowerShell command to remove members from a Microsoft Entra ID group.
Import-Module Microsoft.Graph.Groups
Remove-MgGroupMemberByRef -GroupId $groupId -DirectoryObjectId $directoryObjectId
The table below lists key parameters that can be used with the Remove-MgGroupMemberByRef cmdlet to remove Microsoft Entra ID group members.
| Parameters | Description |
|---|---|
| -Confirm | This you to confirm before running the cmdlet. |
| -DirectoryObjectId | This is the unique identifier of the directory object. |
| -GroupId | This is the unique identifier of a group. |
| -WhatIf | This shows what would happen if the cmdlet was run. |