I have one SharePoint site e.g. test1 - "https://abc.sharepoint.com/sites/test1".
I have granted SharePoint Administrator role to
User1 in the Microsoft 365 Admin Center (Note -
User1 does not have any permissions to the site test1 but has assigned a role of SharePoint Administrator through admin center)
I want to add the user
User2 as a site collection admin to the site
test1 using the PowerShell.
But when I am trying to connect to the site
test1 using PnP command
Connect-PnPOnline and credentials of
User1, I am getting
The remote server returned an error: (401) Unauthorized..
Is it possible to add site collection admin to the site
test1 using CSOM PowerShell + User having SharePoint Administrator role(User1 in this case).
or is there any other workaround?
Please guide me on this.