SharePoint Online Allow Custom Scripts - Part Three

We have looked at why Microsoft disabled custom scripts in SharePoint Online and where it affects. We have looked in the previous two blogs why and what is the alternative. If you have not gone through that, please check below links.
In this post, we are going to review how to enable custom scripting on the site collection level and what will be its impact.
So if we enable scripting at the tenant level, we may end up losing control over security. Instead, Microsoft Provided a way to enable scripting at the site collection level.


  • SharePoint Online Management Shell 
Follow below steps to enable scripting at site collection level:
  • Open the SharePoint Online Management Shell console. 
  • Execute the command to connect Office 365 :

    Connect-SPOService -Url

  • Execute the command below with the URL for the site collection where you want to enable scripting.

    Set-SPOSite -Identity -DenyAddAndCustomizePages 0


  • Tenant level scripting enables may take up to 24 hours. But this approach disables the scripting block immediately. 
  • As these settings are enabled at specific site collection, you can make sure the scripting do not affect other site collections or tenant.


We have seen limitations and how to overcome that. If you need to enable scripting, choose the settings as per your need.