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?