Enable Scripting

In Office365, it is desirable to be able to configure the look and feel, and behaviour of pages through the use of JavaScript, HTML or even PowerShell.  The ability to do this is disabled by default when a new Office 365 tenant is created.

Most of the time, this feature is then activated as the features are required.  What is less understood is the scope of impact of this setting.

The full list of features that are impacted can be found at https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1F2C515F-5D7E-448A-9FD7-835DA935584F?ui=en-US&rs=en-US&ad=US

To enable scripting, as with most of Office 365, there are two approaches:

  1. Use the UI
  2. Use PowerShell

Using the UI

  1. Open the SharePoint Admin centre in the Office 365 tenant
  2. Select Settings
  3. Under Custom Script select the “Allow …” checkboxes, as shown below


  1. Select OK

This process can take up to 24 hours

Using PowerShell

In the following PowerShell script replace “<TenantName>” with the name of the Office 365 tenant.

$AdminSiteUrl = “https://<TenantName>-admin.sharepoint.com”;
$RootSiteUrl = “

#Using Windows Credential Maanger to store the credentials
Connect-SPOnline -Url $AdminSiteUrl

# Enable scripting
Set-SPOSite -Identity $RootSiteUrl -DenyAddAndCustomizePages $false;

This process will be instant.