Can we set security group as site collection administrator using CSOM in PowerShell in SharePoint Online - Office 365? I tried but getting error like "Company Administrator is not a valid user." Also is there any way to set primary and secondary site collection admin using CSOM in PowerShell? I am using sharepoint online -Office 365. Any idea?
I know it’s possible On Premise, where I have tried it myself and had it working properly (even though it's not supported by Microsoft). My guess is that it will work on SPO-Site as well. Simply run the following PowerShell Command:
Set-SPOsite -secondaryowneralias "domain\group"
Somewhat old I know but just to say that officially at least, you cannot set the primary site collection administrator to be a group. However, you can add an AAD security group to the secondary administrators list.
You can do this directly via the web interface and though PowerShell using Set-SPOUser though you have to specify the group by the claims encoded identifier not by the name. So I assume (though I admit I've not yet actually tried) that you can also do this via CSOM.