Operational Guide
Creating Classic Publishing Sites in SharePoint Online via PowerShell
April 2026
Context
Starting from September 15, 2025, Microsoft has blocked the creation of new classic publishing sites and the activation of related features in SharePoint Online (Message Center MC1117115). This guide details all the steps required to temporarily work around these restrictions using PowerShell, create a site with the STS#0 template (classic Team Site) in Italian with the Rome time zone, and enable the full publishing infrastructure on it.
⚠️ Warning: the workarounds described in this document rely on PowerShell parameters that Microsoft has declared "expected to remain functional beyond March 15, 2026", but without any long-term availability guarantee. It is recommended to plan a migration strategy toward the modern experience.
1. Prerequisites
1.1 Operating System and PowerShell
The operations described in this guide require two distinct PowerShell modules with different runtime requirements:
SharePoint Online Management Shell (module Microsoft.Online.SharePoint.PowerShell): works on Windows PowerShell 5.1 (included in Windows 10/11 and Windows Server 2016+).
PnP.PowerShell (version 3.x, currently available): requires PowerShell 7.4.6 or later, downloadable from: https://github.com/PowerShell/PowerShell/releases
The two PowerShell sessions must therefore be run in separate environments: Windows PowerShell for SPO commands, and PowerShell 7 for PnP commands. Alternatively, the entire flow can be executed from the SharePoint Online Management Shell alone by using CSOM for feature activation (described as a variant in Step 5).
1.2 Required Permissions
The account used must be SharePoint Administrator or Global Administrator in the Microsoft 365 tenant. In particular, the Set-SPOTenant parameter requires SharePoint administrator privileges at tenant level, while site creation and feature activation require at least Site Collection Administrator permissions.
1.3 SharePoint Online Management Shell Module
The parameter -AllowClassicPublishingSiteCreation was introduced in version 16.0.26211.12010. The minimum required version is therefore 16.0.26211.12010, but it is recommended to always install the latest available version (at the time of writing: 16.0.27111.12000).
Verify the installed version (run in Windows PowerShell as Administrator):
Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select-Object Name, Version
If the module is not installed, or the version is lower than 16.0.26211.12010, proceed with installation or upgrade.
Remove previous versions (required to avoid conflicts):
# If installed via PowerShell Gallery
Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -AllVersions -Force
# If installed via MSI, uninstall from:
Control Panel > Programs and Features > "SharePoint Online Management Shell"
Install from PowerShell Gallery:
Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Force -AllowClobber
Post-installation verification (close and reopen the PowerShell session before running):
Import-Module Microsoft.Online.SharePoint.PowerShell
Get-Module -Name Microsoft.Online.SharePoint.PowerShell | Select-Object Name, Version
ℹ️ The output must show a version >= 16.0.26211.12010.
1.4 PnP.PowerShell Module (optional, for feature activation)
The PnP.PowerShell module is required to activate publishing features via the Enable-PnPFeature cmdlet. The minimum required version is 2.x (legacy series on PowerShell 5.1, no longer updated) or, as recommended, the 3.x series which requires PowerShell 7.4.6+. At the time of writing, the latest stable version is 3.1.0.
Installation (run in PowerShell 7 as Administrator):
Install-Module -Name PnP.PowerShell -Force -AllowClobber
Verification:
Get-Module -Name PnP.PowerShell -ListAvailable | Select-Object Name, Version
ℹ️ If you prefer not to install PnP.PowerShell and stay entirely on Windows PowerShell 5.1, you can activate features via CSOM directly in the SPO Management Shell session. The CSOM procedure is described as a variant in Step 6.
1.5 Required Information Before Proceeding
Before running the commands, note the following values that will be used throughout the procedure:
Parameter | Value | Notes |
Admin Center URL | https://<tenant>-admin.sharepoint.com | Replace <tenant> with your tenant name |
New site URL | https://<tenant>.sharepoint.com/sites/<SiteName> | Choose the desired path |
Site owner | admin@<tenant>.onmicrosoft.com | UPN of the owner user |
Template | STS#0 | Classic Team Site |
LocaleId | 1040 | Italian (Italy) |
TimeZoneId | 4 | (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna |
2. Connecting to the SharePoint Online Tenant
Open Windows PowerShell as Administrator and run:
Import-Module Microsoft.Online.SharePoint.PowerShell
Connect-SPOService -Url "https://<tenant>-admin.sharepoint.com"
You will be prompted for authentication. Enter the credentials of the account with SharePoint Administrator or Global Administrator privileges. If the tenant uses multi-factor authentication (MFA), the interactive browser authentication window will open automatically.
3. Enabling Tenant-Level Configuration
3.1 Enable Classic Publishing Site Creation
This command re-enables both the creation of site collections with publishing templates and the activation of publishing features on existing site collections:
Set-SPOTenant -AllowClassicPublishingSiteCreation $true
Verification:
(Get-SPOTenant).AllowClassicPublishingSiteCreation
ℹ️ The returned value must be True.
3.2 Status of Related Parameters (Reference)
For completeness, the following table lists other parameters related to classic site governance and their status as of April 2026:
Parameter | Status (April 2026) | Notes |
DelayDenyAddAndCustomizePagesEnforcementOnClassicPublishingSites | ❌ Expired March 15, 2026 | No longer usable. It allowed deferring the disabling of custom scripting on all classic publishing sites at tenant level. |
AllowClassicPublishingSiteCreation | ✅ Still functional | Enables creation of new publishing sites and activation of publishing features. |
DenyAddAndCustomizePages (site level via Set-SPOSite) | ✅ Still functional | However, the value automatically resets to $true (blocked) after a maximum of 24 hours. |
4. Creating the STS#0 Site
Run the following command in the same PowerShell session:
New-SPOSite -Url "https://<tenant>.sharepoint.com/sites/<NomeSito>" -Title "Titolo del sito" -Owner "admin@<tenant>.onmicrosoft.com" -Template "STS#0" -LocaleId 1040 -TimeZoneId 4
Details of the parameters used:
-Url: specifies the full URL of the new site collection.
-Title: the display name of the site.
-Owner: UPN of the user who will be Site Collection Administrator.
-Template "STS#0": selects the classic Team Site template.
-LocaleId 1040: sets Italian (Italy) language. Use 1033 for English (US).
-TimeZoneId 4: sets the time zone "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna". The -StorageQuota parameter is not specified, so the site will use storage from the tenant's shared pool (default behavior).
Waiting for provisioning: creating a site collection can take from a few seconds to several minutes. You can check the status with:
Get-SPOSite -Identity "https://<tenant>.sharepoint.com/sites/<SiteName>" | Select-Object Url, Status, Template, LocaleId
ℹ️ The status must be Active and the template STS#0.
5. Enabling Custom Scripting on the Site
Custom scripting is required to work with custom page layouts, master pages, and other publishing infrastructure customizations.
Set-SPOSite -Identity "https://<tenant>.sharepoint.com/sites/<NomeSito>" -DenyAddAndCustomizePages $false
Verification:
(Get-SPOSite -Identity "https://<tenant>.sharepoint.com/sites/<SiteName>").DenyAddAndCustomizePages
ℹ️ The returned value must be Disabled (meaning: custom scripting allowed).
⚠️ Important: this setting automatically resets to Deny (blocked) after a maximum of 24 hours. You will need to re-run this command each time you need to make changes to page layouts, master pages, or other customizations that require custom scripting.
6. Activating Publishing Features
The publishing infrastructure in SharePoint consists of two distinct features that must be activated in order: first the feature at Site Collection level, then the one at Web (site) level.
Feature | GUID | Scope |
SharePoint Server Publishing Infrastructure | f6924d36-2fa8-4f0b-b16d-06b7250180fa | Site (Site Collection) |
SharePoint Server Publishing | 94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb | Web (site) |
6.1 Option A — With PnP.PowerShell (recommended)
Open PowerShell 7 as Administrator (separate session from SPO) and run:
Import-Module PnP.PowerShell Connect-PnPOnline -Url "https://<tenant>.sharepoint.com/sites/<SiteName>" -Interactive
Activate the feature at Site Collection level:
Enable-PnPFeature -Identity "f6924d36-2fa8-4f0b-b16d-06b7250180fa" -Scope Site -Force
Activate the feature at Web level:
Enable-PnPFeature -Identity "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" -Scope Web -Force
Verification:
Get-PnPFeature -Scope Site | Where-Object { $_.DefinitionId -eq "f6924d36-2fa8-4f0b-b16d-06b7250180fa" }
Get-PnPFeature -Scope Web | Where-Object { $_.DefinitionId -eq "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" }
ℹ️ Both commands must return an object (not empty), confirming the features are active.
6.2 Option B — With CSOM in Windows PowerShell 5.1 (without PnP)
If you prefer not to install PnP.PowerShell, you can activate features using CSOM directly in Windows PowerShell. This approach uses the DLLs from the already-installed SharePoint Online Management Shell module:
# Load CSOM assemblies (path may vary by version)
$modulePath = (Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1).ModuleBase
Add-Type -Path "$modulePath\Microsoft.SharePoint.Client.dll"
Add-Type -Path "$modulePath\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "$modulePath\Microsoft.Online.SharePoint.Client.Tenant.dll"
# Connection
$siteUrl = "https://<tenant>.sharepoint.com/sites/<SiteName>"
$credential = Get-Credential
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$securePassword = $credential.Password
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credential.UserName, $securePassword)
$ctx.Credentials = $credentials
# Activate Site Collection feature (Publishing Infrastructure)
$site = $ctx.Site
$featureGuidSite = [System.Guid]::Parse("f6924d36-2fa8-4f0b-b16d-06b7250180fa")
$site.Features.Add($featureGuidSite, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$ctx.ExecuteQuery() Write-Host "Publishing Infrastructure feature activated at Site Collection level." -ForegroundColor Green
# Activate Web feature (Publishing)
$web = $ctx.Web
$featureGuidWeb = [System.Guid]::Parse("94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb") $web.Features.Add($featureGuidWeb, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$ctx.ExecuteQuery()
Write-Host "Publishing feature activated at Web level." -ForegroundColor Green $ctx.Dispose()
⚠️ If the account uses MFA, the CSOM approach with Get-Credential will not work. In that case, use PnP.PowerShell (Option A) or register an Azure AD app with certificate-based authentication.
7. Final Verification
At the end of the procedure, the site must have the following characteristics. Verify by navigating to:
https://<tenant>.sharepoint.com/sites/<SiteName>/_layouts/15/settings.aspx
The Pages library must be present in the site contents.
The Master Page Gallery (_catalogs/masterpage) must contain the default page layouts.
Under Site Settings > Site Collection Features, the "SharePoint Server Publishing Infrastructure" feature must be Active.
Under Site Settings > Manage Site Features, the "SharePoint Server Publishing" feature must be Active.
The site language must be Italian and the time zone (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna.
8. Command Summary
For convenience, the complete command sequence in execution order:
Session 1 — Windows PowerShell 5.1 (Administrator)
# Connect to the tenant
Import-Module Microsoft.Online.SharePoint.PowerShell Connect-SPOService -Url "https://<tenant>-admin.sharepoint.com"
# Enable publishing site creation
Set-SPOTenant -AllowClassicPublishingSiteCreation $true
# Create Italian STS#0 site with Rome time zone
New-SPOSite `
-Url "https://<tenant>.sharepoint.com/sites/<SiteName>" `
-Title "Site Title" `
-Owner "admin@<tenant>.onmicrosoft.com" `
-Template "STS#0" `
-LocaleId 1040 `
-TimeZoneId 4
# Enable custom scripting (valid for 24 hours)
Set-SPOSite -Identity "https://<tenant>.sharepoint.com/sites/<SiteName>" `
-DenyAddAndCustomizePages $false
Session 2 — PowerShell 7.4.6+ (Administrator)
# Connect to the site with PnP
Import-Module PnP.PowerShell Connect-PnPOnline -Url "https://<tenant>.sharepoint.com/sites/<SiteName>" -Interactive
# Activate Publishing Infrastructure (Site Collection)
Enable-PnPFeature -Identity "f6924d36-2fa8-4f0b-b16d-06b7250180fa" -Scope Site -Force
# Activate Publishing (Web)
Enable-PnPFeature -Identity "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" -Scope Web -Force
9. References
MC1117115 — Updates to custom scripting in sites and Classic Publishing site creation:
https://mc.merill.net/message/MC1117115
Set-SPOTenant — Official documentation:
https://learn.microsoft.com/en-us/powershell/module/microsoft.online.sharepoint.powershell/set-spotenant
SharePoint Online Management Shell — Download: https://www.microsoft.com/en-us/download/details.aspx?id=35588
PnP.PowerShell — Installation: https://pnp.github.io/powershell/articles/installation.html
SharePoint TimeZoneId Values:
https://blog.jussipalo.com/2013/10/list-of-sharepoint-timezoneid-values.html
SharePoint Modernization Guide:
https://learn.microsoft.com/en-us/sharepoint/dev/transform/modernize-guidance
