Skip to main content

entra m365group remove

Removes an Microsoft 365 Group

Usage

m365 entra m365group remove [options]

Options

-i, --id [id]

The ID of the Microsoft 365 Group to remove. Specify either id or displayName, but not both.

-n, --displayName [displayName]

Display name of the Microsoft 365 Group to remove. Specify either id or displayName, but not both.

-f, --force

Don't prompt for confirming removing the group

--skipRecycleBin

Set to directly remove the group without moving it to the Recycle Bin

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, 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

If the specified id doesn't refer to an existing group, you will get a Resource does not exist error. Additionally, if you do not have access to the group or the associated group-connected site, you will get an Access denied error.

When you use --skipRecycleBin flag to remove a Microsoft 365 group permanently, the process involves deleting the associated group-connected site and the group, and then checking if the group has been moved to the deleted groups list. In some cases, it may take a few seconds for the group to appear in the deleted groups list.

To ensure a smooth deletion process, the command employs a retry mechanism with the following parameters:

  • maxRetries: This parameter is set to 10 by default. It specifies the maximum number of times the command will check if the group has been moved to the deleted groups list.

  • intervalInMs: This parameter is set to 5000 milliseconds (5 seconds) by default. It defines the time interval between each retry attempt.

If the group is successfully moved to the deleted groups list within the specified number of retries, the command will then proceed to permanently remove it from the tenant. If the group cannot be removed after all retries, it will remain in the deleted groups list.

Examples

Remove group with id 28beab62-7540-4db1-a23f-29a6018a3848. Will prompt for confirmation before removing the group

m365 entra m365group remove --id 28beab62-7540-4db1-a23f-29a6018a3848

Remove group with displayName Finance without prompting for confirmation

m365 entra m365group remove --displayName Finance --force

Remove group with id 28beab62-7540-4db1-a23f-29a6018a3848 without prompting for confirmation and without moving it to the Recycle Bin

m365 entra m365group remove --id 28beab62-7540-4db1-a23f-29a6018a3848 --force --skipRecycleBin

Response

The command won't return a response on success.

CTRL + M