Forum Discussion
Office 365: Add accounts into the Site collection administrators list via PowerShell and CSOM
Sorry for that, but as you can see into that publication created long time ago.
> Microsoft is changing the SharePoint management way and CSOM is probably not anymore the best approach to manage Administrative permission.
> Site Collection administrator is also now out of vision defined with TEAMS
So all that strategical change define by Microsoft since years could explain why this kind of command/script/code could be not usable anymore.
Can you check with PnP instead of ?
Sorry for that
Fab
I did some digging and found that the login names are no longer applicable. Now they are in the form "c:0t.c|tenant|32e1b7a8-foob-are8-8fb7-827c407110c0" where the guid at the end is the object id of the directory role you want to add. You can find these using Get-AzureADDirectoryRole PowerShell command. They are different for each tenancy unfortunately.