Skip to content

Commit 0633f4b

Browse files
committed
Adds 'entra group user remove' command. Closes #5472
1 parent 884c943 commit 0633f4b

File tree

7 files changed

+684
-4
lines changed

7 files changed

+684
-4
lines changed

docs/docs/cmd/entra/group/group-user-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 user add
44

5-
Adds a user to a Microsoft Entra ID group
5+
Adds users to a Microsoft Entra ID 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 user remove
4+
5+
Removes users from a Microsoft Entra ID group
6+
7+
## Usage
8+
9+
```sh
10+
m365 entra group user 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 user 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 user 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 user 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 user 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 user 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
@@ -360,6 +360,11 @@ const sidebars: SidebarsConfig = {
360360
label: 'group user list',
361361
id: 'cmd/entra/group/group-user-list'
362362
},
363+
{
364+
type: 'doc',
365+
label: 'group user remove',
366+
id: 'cmd/entra/group/group-user-remove'
367+
},
363368
{
364369
type: 'doc',
365370
label: 'group user set',

src/m365/entra/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export default {
4141
GROUP_REMOVE: `${prefix} group remove`,
4242
GROUP_USER_ADD: `${prefix} group user add`,
4343
GROUP_USER_LIST: `${prefix} group user list`,
44+
GROUP_USER_REMOVE: `${prefix} group user remove`,
4445
GROUP_USER_SET: `${prefix} group user set`,
4546
GROUPSETTING_ADD: `${prefix} groupsetting add`,
4647
GROUPSETTING_GET: `${prefix} groupsetting get`,

0 commit comments

Comments
 (0)