Skip to content

Bug report - 'aad o365group remove' - the connected SharePoint site is not removed #5224

@martinlingstuyl

Description

@martinlingstuyl

As discussed in issue #5218 we have a couple of issues when removing sites and m365 groups with connected sites.

The issue for the aad o365group remove command is that it uses the Graph API to remove the Azure AD group. This means that the connected SharePoint site is left where it is.

That's not the right behavior: when using aad o365group remove, all connected resources of the group should be removed as well.

To implement this, we need to change the API that is called. The GroupSiteManager api is used by the UI in the admin center. That would be a better fit:

https://contoso-admin.sharepoint.com/_api/GroupSiteManager/Delete
{
"siteUrl": "https://contoso.sharepoint.com/sites/sales"
}

We first need to get the siteUrl for the group and then call this endpoint.
This will delete the site AND the group in one call.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions