Skip to content

Commit 76dfd16

Browse files
committed
Adds 'entra group member remove' command. Closes #5472
1 parent 1a88ed2 commit 76dfd16

File tree

8 files changed

+685
-5
lines changed

8 files changed

+685
-5
lines changed

docs/docs/cmd/entra/group/group-member-add.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Global from '/docs/cmd/_global.mdx';
22

33
# entra group member add
44

5-
Adds a member to a Microsoft Entra ID group
5+
Adds members to a Microsoft Entra group
66

77
## Usage
88

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import Global from '/docs/cmd/_global.mdx';
2+
3+
# entra group member remove
4+
5+
Removes members from a Microsoft Entra group
6+
7+
## Usage
8+
9+
```sh
10+
m365 entra group member remove [options]
11+
```
12+
13+
## Options
14+
15+
```md definition-list
16+
`-i, --groupId [groupId]`
17+
: The ID of the Entra ID group. Specify `groupId` or `groupDisplayName` but not both.
18+
19+
`-n, --groupDisplayName [groupDisplayName]`
20+
: The display name of the Entra ID group. Specify `groupId` or `groupDisplayName` but not both.
21+
22+
`--ids [ids]`
23+
: Entra ID IDs of users. You can also pass a comma-separated list of IDs. Specify either `ids` or `userNames` but not both.
24+
25+
`--userNames [userNames]`
26+
: The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either `ids` or `userNames` but not both.
27+
28+
`-r, --role [role]`
29+
: The role to be removed from the users. Valid values: `Owner`, `Member`. Defaults to both.
30+
31+
`--suppressNotFound`
32+
: Suppress errors when a user was not found in a group.
33+
34+
`-f, --force`
35+
: Don't prompt for confirmation.
36+
```
37+
38+
<Global />
39+
40+
## Remarks
41+
42+
:::tip
43+
44+
When you use the `suppressNotFound` option, the command will not return an error if a user is not found as either an owner or a member of the group.
45+
This feature proves useful when you need to remove a user from a group, but you are uncertain whether the user holds the role of a member or an owner within that group.
46+
Without using this option, you would need to manually verify the user's role in the group before proceeding with removal.
47+
48+
:::
49+
50+
## Examples
51+
52+
Remove a single user specified by ID as member from a group specified by display name
53+
54+
```sh
55+
m365 entra group member remove --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
56+
```
57+
58+
Remove multiple users specified by ID from a group specified by ID
59+
60+
```sh
61+
m365 entra group member remove --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --ids "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8"
62+
```
63+
64+
Remove a single user specified by UPN as an owner from a group specified by display name
65+
66+
```sh
67+
m365 entra group member remove --groupDisplayName Developers --userNames [email protected] --role Owner
68+
```
69+
70+
Remove multiple users specified by UPN from a group specified by ID
71+
72+
```sh
73+
m365 entra group member remove --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --userNames "[email protected],[email protected]"
74+
```
75+
76+
Remove a single user specified by ID as owner and member of the group and suppress errors when the user was not found as owner or member
77+
78+
```sh
79+
m365 entra group member remove --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --suppressNotFound
80+
```
81+
82+
## Response
83+
84+
The command won't return a response on success.

docs/src/config/sidebars.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ const sidebars: SidebarsConfig = {
373373
label: 'group member list',
374374
id: 'cmd/entra/group/group-member-list'
375375
},
376+
{
377+
type: 'doc',
378+
label: 'group member remove',
379+
id: 'cmd/entra/group/group-member-remove'
380+
},
376381
{
377382
type: 'doc',
378383
label: 'group member set',

src/m365/entra/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default {
4040
GROUP_ADD: `${prefix} group add`,
4141
GROUP_GET: `${prefix} group get`,
4242
GROUP_LIST: `${prefix} group list`,
43+
GROUP_MEMBER_REMOVE: `${prefix} group member remove`,
4344
GROUP_REMOVE: `${prefix} group remove`,
4445
GROUP_SET: `${prefix} group set`,
4546
GROUP_MEMBER_ADD: `${prefix} group member add`,

src/m365/entra/commands/group/group-member-add.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class EntraGroupMemberAddCommand extends GraphCommand {
2727
}
2828

2929
public get description(): string {
30-
return 'Adds a member to a Microsoft Entra ID group';
30+
return 'Adds members to a Microsoft Entra group';
3131
}
3232

3333
constructor() {

0 commit comments

Comments
 (0)