How to Disable Sharing

Iron Contributor

I am trying to disable the "Share this item with other people" feature. Microsoft shows this PowerShell function:

Limit sharing in Microsoft 365 | Microsoft Learn

 

But I get an error message saying "Attempted to perform an unauthorized operation".

 

xoxidein_0-1711479970778.png

 

I am a Global Administrator.

2 Replies
Works fine here. Double-check the credentials you used, and also the site URL

@xoxidein Check if user account you are using for running the PowerShell commands have enough permissions on the site.

 

First try using account with SP tenant administrator role on the tenant. If that does not work for you, use account with SP tenant administrator role AND site admin (SCA) permissions on that specific site.

 

Before running Set-SPOSite command, you have to connect to admin center using Connect-SPOService like: 

 

Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential email address removed for privacy reasons

 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.