New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug report - 'aad o365group remove' - the connected SharePoint site is not removed #5224
Comments
Hi Martin, Can I work on it? |
Oh, I see you have already planned to work on this one - #5218 |
I think Martin means that he could pick it up after his holiday if it hasn't been picked up by someone else yet. |
I tried running the "m365 aad o365group remove" command to assess its behavior, and it appears to work as expected. The command successfully removes both the o365 group and its associated SharePoint site. Although the deletion process takes a few minutes, the site eventually gets deleted. Can anyone please test the command and and let us know your results? |
Reading it again, I'm wondering if this is the desired behavior. If I'm not mistaken, if you remove an M365 group from the Azure portal, the SharePoint site will still be there. If you want to remove all connected resources, you should use the SP admin center to remove the site with its connected resources. In that case, people should use |
Removing an M365 group from the Azure portal does remove the associated site. To me, it seems logical that resources created with the group are deleted upon the group's deletion. |
It might be logical indeed, but from my experience, if you remove the group from the Azure portal, the SP site remains there. Just tested it with a new group and had the same behavior. Group is gone, site is still there. Unless I remove the site via the SP admin center and check the box to remove all associated resources, the site stays there. |
I just found that if you're the owner of a group and site and you delete the group, the associated site also gets deleted. If you're not an owner and you delete the group, the group itself gets removed, but the site continues to exist. Reading more about it, Microsoft states that attempting to delete the O365 group will result in the entire site being deleted – this is by design. Therefore, if the site is not deleted because the person deleting the group is not an owner, it appears to be a bug. Martin's suggestion seems to provide a fail-safe approach. I will try to implement that. |
That's weird, I just created the group displayed above. If I create it, I should be an owner, right? Strange behavior 😄 |
Hi @martinlingstuyl, Should we remove the |
Hi @Saurabh7019, we should not remove the option. Instead we can probably remove the site from the recycle bin with an extra call. Am I right? |
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:
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.
The text was updated successfully, but these errors were encountered: