Skip to main content

entra m365group user remove

Removes the specified user from specified Microsoft 365 Group or Microsoft Teams team

Usage

m365 entra m365group user remove [options]

Options

-i, --groupId [groupId]

The ID of the Microsoft 365 group. Specify only one of the following: groupId, groupName, teamId, or teamName.

--groupName [groupName]

The display name of the Microsoft 365 group. Specify only one of the following: groupId, groupName, teamId, or teamName.

--teamId [teamId]

The ID of the Microsoft Teams team. Specify only one of the following: groupId, groupName, teamId, or teamName.

--teamName [teamName]

The display name of the Microsoft Teams team. Specify only one of the following: groupId, groupName, teamId, or teamName.

--ids [ids]

Microsoft Entra 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.

-f, --force

Don't prompt for confirming removing the user from the specified Microsoft 365 Group or Microsoft Teams team.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, permissions, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

You can remove users from a Microsoft 365 Group or Microsoft Teams team if you are owner of that group or team.

Permissions

ResourcePermissions
Microsoft GraphGroup.ReadWrite.All, User.ReadBasic.All

Examples

Removes user from the specified Microsoft 365 Group.

m365 entra m365group user remove --groupId '5b8e4cb1-ea40-484b-a94e-02a4313fefb4' --userNames 'anne.matthews@contoso.onmicrosoft.com'

Removes user from the specified Microsoft 365 Team specified by id without confirmation.

m365 entra m365group user remove --teamId '5b8e4cb1-ea40-484b-a94e-02a4313fefb4' --userNames 'anne.matthews@contoso.onmicrosoft.com' --force

Removes users specified by a comma separated list of user principal names from the specified Microsoft Teams team specified by name

m365 entra m365group user remove --teamName 'Project Team' --userNames 'anne.matthews@contoso.onmicrosoft.com,john@contoso.com'

Removes users specified by a comma separated list of user ids from the specified Microsoft 365 group specified by name.

m365 entra m365group user remove --groupName 'Project Team' --ids '5b8e4cb1-ea40-484b-a94e-02a4313fefb4,be7a56d8-b045-4938-af35-917ab6e5309f'

Response

The command won't return a response on success.