It is challenging to add the Office 365 Cloud security groups of format – xxxx.onmicrosoft.com, to a SharePoint sites as they are not found through AD so SharePoint cannot find them through the UPN or Domain\GroupName.
In order to add these cloud security groups, we have to go through a workaround to get the unique role manager ID of format below and then add it to SharePoint through PowerShell
In order to get the unique role manager ID follow the below steps:
- Open a SharePoint Site
- Go to Site Permissions
- Add the Office 365 Cloud security group (xxxx.onmicrosoft.com) to SharePoint Site Permissions
- Click on the added group to get to the User Information page
- Copy the role manager ID in the above format from the account column
After you have got the role manager ID, now you can add it through PnP PowerShell using the security cmdlets. The cmdlet might vary based on which location and how you are trying to add this cloud group.
Hence, by above we can add Office 365 cloud security groups to SharePoint also.
Happy coding !!