|
| 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. |
0 commit comments