I'm trying to set the Sharing setting of a site in a provisioning script. After creating a Team site (classic experience) site, I want to set the sharing to new and existing users we have set in the Sharing settings of the admin center. The tenant is set to disabled, not sure if this has an impact, we want external sharing to be off except for a few limited sites at this point.

After creating the site via PowerShell, I try executing Set-SPOSite -Identity $siteURL -SharingCapability ExternalUserSharingOnly. It doesn't throw any errors, but it doesn't set the appropriate value, still reads disabled in PowerShell and is disbaled in the admin center.

What is happening?

1 Answer 1


From your description, external sharing is disabled at organization level.

Quote from Microsoft:

To allow external sharing on any site, you must allow it at the organization level.


Please try following PnP powershell to set external sharing at tenant level:

Connect-PnPOnline -Url https://tenant.sharepoint.com -Credentials (Get-Credential)
Set-PnPTenant -SharingCapability $ExternalUserAndGuestSharing



  • I can manually set it in the SPO admin center though, if it can be set manually, why can it not be set programmatically? Nov 17, 2020 at 13:53
  • I have updated my reply, please check it.
    – Julie_MSFT
    Nov 18, 2020 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.