Unable to allow custom scripts for SharePoint site in admin tenant

Mansi Gupta 20 Reputation points
2025-07-25T10:26:18.0633333+00:00

Hi!

I am unable to allow custom scripts for Sharepoint sites in admin tenant.

Even after clicking on Allowed and saving, it is still showing Blocked.

Attached are the images for reference.

Thanks!

User's image

User's image

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

Answer accepted by question author
  1. Steven-N 16,030 Reputation points Microsoft External Staff Moderator
    2025-07-25T11:13:52.72+00:00

    Hi Mansi Gupta

    Thanks for reaching out to Microsoft Q&A forum support and apologize for the inconvenience 

    Based on this document: LINK ARTICLE

    Any changes to custom script settings for a specific site only last for a maximum of 24 hours. After that time, the setting resets to Blocked. 

    This behavior is intentional and part of Microsoft’s security model for SharePoint Online. It applies to most site types, including those created via the SharePoint admin center, PowerShell, OneDrive, and modern team or communication sites. 

    User's image As far as I know, to persist the setting longer, you need to use PowerShell to enable custom script at the site level. Here are the recommended commands: 

    Set-SPOSite <SiteURL> -DenyAddAndCustomizePages 0
    

    or with the PnP.PowerShell cmdlet Set-PnPSite

    Set-PnPSite -Identity <SiteURL> -NoScriptSite $false
    

    Hope my answer will help you.

    For any further support, kindly let us know.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".     

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.