How do I set DenyAddAndCustomizePages for SharePoint 2019 communication site

%3CLINGO-SUB%20id%3D%22lingo-sub-303980%22%20slang%3D%22en-US%22%3EHow%20do%20I%20set%20DenyAddAndCustomizePages%20for%20SharePoint%202019%20communication%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-303980%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20set%20up%20a%20fresh%20new%20instance%20of%20SharePoint%202019%2C%20I've%20set%20up%20a%20communication%20site%20in%20Dev%20environment%20and%20wanted%20to%20save%20this%20site%20as%20a%20template%2C%20unfortunatly%20the%20option%20is%20not%20available%20and%20I%20get%20an%20%22access%20denied%22%20when%20accessing%20to%20the%20page%20thanks%20to%20the%20url.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnyonye%20know%20if%20the%20same%20option%20can%20be%20applied%20as%20we%20can%20you%20in%20SharePoint%20Online%3A%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22kwd%22%3Eset%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E-%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Esposite%20https%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3A%3C%2FSPAN%3E%3CSPAN%20class%3D%22com%22%3E%2F%2Ftenant.sharepoint.com%2Fsites%2Fcommunication%20-denyaddandcustomizepages%20%24false%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20by%20advance%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-303980%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Esharepoint2019%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-321050%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20set%20DenyAddAndCustomizePages%20for%20SharePoint%202019%20communication%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-321050%22%20slang%3D%22en-US%22%3E%3CP%3EI%20ran%20into%20this%20issue%20during%20a%20migration%20to%20SP%202019%2C%20some%20features%20are%20not%20available%20until%20this%20is%20reset.%26nbsp%3B%20See%20this%20posted%20solution%3A%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3EFrom%20%26lt%3B%3CA%20href%3D%22http%3A%2F%2Fblog.konffaaja.com%2F2018%2F11%2Fsharepoint-2019-and-2019-denyaddandcustomizepages%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fblog.konffaaja.com%2F2018%2F11%2Fsharepoint-2019-and-2019-denyaddandcustomizepages%2F%3C%2FA%3E%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%24site%20%3D%20Get-SPSite%20-Identity%20%22%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fintranet.contoso.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%3CSPAN%3Ehttps%3A%2F%2Fintranet.contoso.com%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%3E%22%3CBR%20%2F%3E%24site.DenyPermissionsMask%20%3D%20%5BMicrosoft.SharePoint.SPBasePermissions%5D%3A%3AEmptyMask%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-307175%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20set%20DenyAddAndCustomizePages%20for%20SharePoint%202019%20communication%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-307175%22%20slang%3D%22en-US%22%3Ei%20have%20not%20seen%20that%20feature%20in%20any%20group%20enabled%20modern%20sites%20in%20a%20long%20time.%20How%20did%20you%20create%20the%20SPO%20site%20you%20are%20seeing%20it%20in%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-304056%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20set%20DenyAddAndCustomizePages%20for%20SharePoint%202019%20communication%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-304056%22%20slang%3D%22en-US%22%3EThanks%20for%20the%20quick%20answer%20I%20will%20test%20if%20this%20option%20is%20available%20for%20SharePoint%202019%2C%20save%20as%20template%20is%20available%20for%20Modern%20Team%20Site%20that's%20what%20is%20very%20concerning%20about%20this%20feature%3A%2F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-303988%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20set%20DenyAddAndCustomizePages%20for%20SharePoint%202019%20communication%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-303988%22%20slang%3D%22en-US%22%3EHi%2C%20I%20would%20highly%20recommend%20that%20you%20don't%20do%20that.%20That%20feature%20was%20removed%20for%20a%20good%20reason%20as%20it%20causes%20issues%20in%20the%20long%20term.%3CBR%20%2F%3E%3CBR%20%2F%3EAn%20alternative%20is%20to%20use%20the%20PnP%20provisioning%20engine%20and%20extract%20a%20template%20from%20the%20site.%20This%20can%20be%20easily%20done%20with%20PnP%20PowerShell%20and%20is%20very%20well%20documented.%3CBR%20%2F%3E%3CBR%20%2F%3EHope%20this%20helps%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1351288%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20set%20DenyAddAndCustomizePages%20for%20SharePoint%202019%20communication%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1351288%22%20slang%3D%22en-US%22%3E%3CH2%20id%3D%22toc-hId-1702108627%22%20id%3D%22toc-hId-1702108627%22%20id%3D%22toc-hId-1702108627%22%20id%3D%22toc-hId-1702108627%22%20id%3D%22toc-hId-1702108627%22%3E%3CSTRONG%3EThis%20worked%3C%2FSTRONG%3E%3C%2FH2%3E%3CP%3E%3CSPAN%3EThe%20following%20Software%20are%20is%20used%20to%20connect%20to%20your%20SharePoint%20Online%20via%20Powershell%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EDownload%20and%20Install%20SharePoint%20Online%20Management%20Shell%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D35588%22%20target%3D%22_blank%22%20rel%3D%22noreferrer%20noopener%22%3E%3CSPAN%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D35588%3C%2FSPAN%3E%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EWhile%20installation%2C%20and%20if%20you%20get%20an%20error%20%22This%20application%20requires%20the%20following%20to%20be%20installed%3A%20-%20PowerShell%203.0%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EStep%202%3A%20Open%20SharePoint%20Online%20Management%20Shell%20from%20your%20window%20search%20bar.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId--850048334%22%20id%3D%22toc-hId--850048334%22%20id%3D%22toc-hId--850048334%22%20id%3D%22toc-hId--850048334%22%20id%3D%22toc-hId--850048334%22%3E%3CSPAN%3EStep%203%3A%20Connect%20to%20your%20SharePoint%20Admin%20Portal%3C%2FSPAN%3E%3C%2FH2%3E%3CP%3E%3CSPAN%3EType%20the%20following%20command%20to%20open%20connection%3A%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3EConnect-SPOService%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EEnter%20the%20Url%20for%20your%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3CSTRONG%3ESharePoint%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EAdmin%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EPortal%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3CSTRONG%3E(not%20your%20site%2C%20not%20yet)%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%3E%3CSTRONG%3E%3A%3C%2FSTRONG%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EUrl%3A%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fyour-domain-admin.sharepoint.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noreferrer%20noopener%20nofollow%22%3E%3CSPAN%3Ehttps%3A%2F%2F%3C%2FSPAN%3E%3CSPAN%3Eyour-domain%3C%2FSPAN%3E%3CSPAN%3E-admin.sharepoint.com%3C%2FSPAN%3E%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EReplace%20with%20your%20domain%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EHit%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3CSTRONG%3EEnter%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3ESign%20in%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIt%20will%20ask%20you%20for%20username%20and%20password%20for%20the%20user%20who%20has%20permission%20to%20manage%20SharePoint%20from%20SharePoint%20Admin%20Center%3C%2FSPAN%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId-892762001%22%20id%3D%22toc-hId-892762001%22%20id%3D%22toc-hId-892762001%22%20id%3D%22toc-hId-892762001%22%20id%3D%22toc-hId-892762001%22%3E%26nbsp%3B%3C%2FH2%3E%3CH2%20id%3D%22toc-hId--1659394960%22%20id%3D%22toc-hId--1659394960%22%20id%3D%22toc-hId--1659394960%22%20id%3D%22toc-hId--1659394960%22%20id%3D%22toc-hId--1659394960%22%3E%3CSPAN%3E%3CSTRONG%3EStep%204%3A%20Enable%20Scripting%20Capabilities%20on%20your%20site.%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH2%3E%3CDIV%3E%3CSPAN%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EFirst%20check%20the%20status%20of%20the%20site%20for%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EDenyAddAndCustomizePages%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EGet-SPOsite%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fyour-domain.sharepoint.com%2Fsites%2Fmodern-site%22%20target%3D%22_blank%22%20rel%3D%22noreferrer%20noopener%20nofollow%22%3Ehttps%3A%2F%2Fyour-domain.sharepoint.com%2Fsites%2Fmodern-site%3C%2FA%3E%26nbsp%3B%7C%20Select%26nbsp%3BDenyAddAndCustomizePages%3C%2FSPAN%3E%3C%2FDIV%3E%3CP%3E%3CSPAN%3EType%20the%20following%20command%20that%20will%20enable%20scripting%20capabilities%20on%20your%20modern%20site%20and%20any%20other%20site%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3ESet-SPOsite%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fyour-domain.sharepoint.com%2Fsites%2Fmodern-site%22%20target%3D%22_blank%22%20rel%3D%22noreferrer%20noopener%20nofollow%22%3E%3CSPAN%3Ehttps%3A%2F%2F%3C%2FSPAN%3E%3CSPAN%3Eyour-domain%3C%2FSPAN%3E%3CSPAN%3E.sharepoint.com%2F%3C%2FSPAN%3E%3CSPAN%3Esites%2Fmodern-site%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E-DenyAddAndCustomizePages%200%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EReplace%20with%20your%20domain%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EReplace%20with%20the%20path%20of%20your%20modern%20site%3C%2FSPAN%3E%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2594090%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20set%20DenyAddAndCustomizePages%20for%20SharePoint%202019%20communication%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2594090%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9907%22%20target%3D%22_blank%22%3E%40Joel%20Rodrigues%3C%2FA%3E%26nbsp%3BI%20know%20this%20is%20an%20old%20topic%2C%20but%20more%20information%20on%20what%20issues%20can%20be%20caused%20that%20would%20be%20very%20helpful.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2663876%22%20slang%3D%22en-US%22%3ERe%3A%20How%20do%20I%20set%20DenyAddAndCustomizePages%20for%20SharePoint%202019%20communication%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2663876%22%20slang%3D%22en-US%22%3EHi%20Aaron%2C%3CBR%20%2F%3E%3CBR%20%2F%3EJust%20to%20be%20clear%2C%20I%20was%20referring%20to%20the%20classic%20way%20of%20savings%20sites%20as%20templates.%20A%20common%20case%20is%20that%20sites%20created%20using%20these%20templates%20may%20not%20receive%20updates%20from%20Microsoft%20due%20to%20the%20way%20the%20classic%20templates%20work%3C%2FLINGO-BODY%3E
New Contributor

Hello,

 

I've set up a fresh new instance of SharePoint 2019, I've set up a communication site in Dev environment and wanted to save this site as a template, unfortunatly the option is not available and I get an "access denied" when accessing to the page thanks to the url.

 

Anyonye know if the same option can be applied as we can you in SharePoint Online:

set-sposite https://tenant.sharepoint.com/sites/communication -denyaddandcustomizepages $false

 

Thanks by advance 

7 Replies
Hi, I would highly recommend that you don't do that. That feature was removed for a good reason as it causes issues in the long term.

An alternative is to use the PnP provisioning engine and extract a template from the site. This can be easily done with PnP PowerShell and is very well documented.

Hope this helps
Thanks for the quick answer I will test if this option is available for SharePoint 2019, save as template is available for Modern Team Site that's what is very concerning about this feature:/
i have not seen that feature in any group enabled modern sites in a long time. How did you create the SPO site you are seeing it in?

I ran into this issue during a migration to SP 2019, some features are not available until this is reset.  See this posted solution:  

From <http://blog.konffaaja.com/2018/11/sharepoint-2019-and-2019-denyaddandcustomizepages/>

 

$site = Get-SPSite -Identity "https://intranet.contoso.com"
$site.DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

 

 

This worked

The following Software are is used to connect to your SharePoint Online via Powershell:

 

Download and Install SharePoint Online Management Shell

https://www.microsoft.com/en-us/download/details.aspx?id=35588

 

While installation, and if you get an error "This application requires the following to be installed: - PowerShell 3.0"

Step 2: Open SharePoint Online Management Shell from your window search bar.

 

 

Step 3: Connect to your SharePoint Admin Portal

Type the following command to open connection: 

Connect-SPOService

 

 

Enter the Url for your SharePoint Admin Portal (not your site, not yet)

 

Url: https://your-domain-admin.sharepoint.com

Replace with your domain

 

 

Hit Enter

 

Sign in

It will ask you for username and password for the user who has permission to manage SharePoint from SharePoint Admin Center

 

Step 4: Enable Scripting Capabilities on your site.

 
First check the status of the site for DenyAddAndCustomizePages  Get-SPOsite https://your-domain.sharepoint.com/sites/modern-site | Select DenyAddAndCustomizePages

Type the following command that will enable scripting capabilities on your modern site and any other site:

 

Set-SPOsite https://your-domain.sharepoint.com/sites/modern-site -DenyAddAndCustomizePages 0

Replace with your domain

Replace with the path of your modern site

 

@Joel Rodrigues I know this is an old topic, but more information on what issues can be caused that would be very helpful.

Hi Aaron,

Just to be clear, I was referring to the classic way of savings sites as templates. A common case is that sites created using these templates may not receive updates from Microsoft due to the way the classic templates work