How to remove a member from an Azure AD group using PowerShell scripts
Administrators use Azure Active Directory (AD) groups to manage users and their permissions collectively. The PowerShell cmdlet in the table below can be used to remove members from Azure AD groups. ADManager Plus, a unified Active Directory, Microsoft 365, Exchange, and Google Workspace management and reporting tool, can also be used to accomplish this task.
The following table is a comparison on how to remove members from an Azure AD group using PowerShell scripts and ADManager Plus.
Azure PowerShell
Steps to remove members from an Azure AD group using PowerShell scripts:
- Note down the variables of the required parameters (ObjectId, MemberId, InformationAction, InformationVariable, and other CommonParameters) for removing members from the group.
- Execute the following PowerShell script with the required parameters and their values. An example of this is given below.
Copied
Remove-AzureADGroupMember
-ObjectId <ObjectId>
-MemberId <MemberId>
[-InformationAction <ActionPreference>]
[-InformationVariable <Var>]
[<CommonParameters>]
Click to copy entire script
Where <ObjectId> refers to the ID of the group, <MemberId> refers to the ID of the member to remove, <ActionPreference> describes the way in which this cmdlet reacts to an information event, and <var> refers to the information variable.
ADManager Plus
Steps to remove members from an Azure AD group using ADManager Plus:
- Log in to ADManager Plus and navigate to Microsoft 365 tab > Management > Group Management.
- Under Group Member Management, click Add/Remove Group Members using CSV.
- Select the desired Microsoft 365 tenant from the Microsoft 365 Tenant drop-down.
- Browse and select the CSV file containing the list of members along with group information, and click Import Group(s) or Member(s).
- Select the desired group members and click Apply.
Limitations of using PowerShell scripts to remove members from an Azure AD group
- Administrators must have sufficient permissions to modify memberships of Azure AD groups if they wish to use the above-mentioned PowerShell script. However, one wrong move from the administrator can affect the security posture of your organization.
- Only technicians with PowerShell expertise can execute this command.
- To remove multiple members from a group, admins will have to manually make note of the ObjectIds of all members and run separate scripts for removing each of these members.
- PowerShell scripts are time-consuming and can affect productivity.
Benefits of using ADManager Plus:
- ADManager Plus provides you with group modification templates that simplify the process of group modification in bulk.
- ADManager Plus comes with an intuitive UI and does not demand extensive knowledge of PowerShell.
- Management actions come built-in with ADManager Plus and can be performed at the click of a button.