New command: `entra group member remove`
Usage
m365 entra group member remove [options]
Description
Removes members from a Microsoft Entra group
Options
| Option | Description |
|---|---|
-i, --groupId [groupId] |
The ID of the Azure AD group. Specify groupId or groupDisplayName but not both. |
-n, --groupDisplayName [groupDisplayName] |
The display name of the Azure AD group. Specify groupId or groupDisplayName but not both. |
--ids [ids] |
Azure AD IDs of users. You can also pass a comma-separated list of IDs. Specify either ids or userNames but not both. |
--userNames [userNames] |
The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either ids or userNames but not both. |
-r, --role [role] |
The role to be removed from the new user. Valid values: Owner, Member. Defaults to both. |
-f, --force |
Don't prompt for confirmation. |
Examples
Remove a single user specified by ID as a member from a group specified by display name
m365 entra group member remove --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
Remove multiple users specified by ID from a group specified by ID
m365 entra group member remove --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --ids "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8"
Remove a single user specified by UPN as an owner from a group specified by display name
m365 entra group member remove --groupDisplayName Developers --userNames [email protected] --role Owner
Removes multiple users specified by UPN from a group specified by ID
m365 entra group member remove --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --userNames "[email protected],[email protected]"
Default properties
No response
Additional Info
Let's use Graph batching.
@pnp/cli-for-microsoft-365-maintainers, currently if a user is a member of a group and you run this command without the role option, you get an error because it tries to remove the user both from the owner and member part of the group.
Would it make sense if we add an extra flag --supressNotFound where people can choose to ignore not found errors?
In my opinion, this would increase user-friendliness. Imagine you want to remove 3 users from a group. One is owner, one is member, and one is owner + member. This means that you will have to run the command 2 times with 2 different values. If we suppress not found errors, the user would be able to do this in one go.
That would indeed make it even more user-friendly. That option sounds good to me but we should make sure that the explanation is clear enough for the end-users, either in the option description itself or in a well-written remark regarding the usage of that option.
That would indeed make it even more user-friendly. That option sounds good to me but we should make sure that the explanation is clear enough for the end-users, either in the option description itself or in a well-written remark regarding the usage of that option.
+1