I can add myself to any Site Owners group via the web but getting Access Denied using PowerShell

Copper Contributor




Add-SPOUser -Site "https://mysite" -Group "mySite Owners" -LoginName myemail



Add-SPOUser : Attempted to perform an unauthorized operation.


I can successfully add other users to sites I'm already Owner using the above CMD.


Thank you!

4 Replies
To retrieve permissions for sharepoint site, you need to have full control permissions on this site. Ask your site collection administrators to give your full control permissions.

ty, yet, it will let me add myself to the Owners or Admins group of the site from the Web Portal? If I can add myself why do I need to ask the Site Collection admin? (just learning) ty
" I granted the application API permissions for SharePoint Online in Azure AD. I had to grant it full control to all sites." I think you need somebody to give the App Registration more permissions here https://portal.azure.com/#view/Microsoft_AAD_IAM/StartboardApplicationsMenuBlade/~/AppAppsPreview/me... (PnP Management Shell, AllSites.FullControl permissions)

But I'm not a SharePoint expert :)