Good morning all,
I've ran into an issue with Sharepoint online. Normally when we run get-spositegroup we get the following results. I've removed some of the info but there's a user and a role assigned to the group. This way we can manage some of the site settings.
Now for the actual problem. We found a couple of sites where the assigned useraccount has been deleted, and there's no role assigned to the group. This causes problems managing the site. In this image I've removed the GUID from the useraccount (which no longer exists) but you can see there's no role assigned to the group.
I would like to assign a new user to the owner and member groups, so that we can properly manage these sites. I run the following command:
$ownerGroup = Get-SPOSiteGroup -Site https://xxx.sharepoint.com/sites/xxx -Group "xxx Owners" Set-SPOSiteGroup -Site https://xxx.sharepoint.com/sites/xxx -Identity "firstname.lastname@example.org" -Owner $ownerGroup
However this returns "Set-SPOSiteGroup : Group cannot be found", although it is stored in the $ownerGroup variable. Tried googling this message but the only results I found were used for Sharepoint on-prem, not o365. Am I doing something wrong here?