We can set tenant properties even if custom script is disabled(no-script site) for sharepoint modern sites.

Nikhil Rane 191 Reputation points
2022-02-28T12:33:40.62+00:00

According to this document.
We cannot set tenant properties to no-script sites. If tried will get "Access denied. You do not have permission to perform this action or access this resource." in response.

Steps performed:
Create sharepoint modern site.
Open Admin center classic settings page
Disable custom script on sites.
Set tenant properties.
Add spfx to sites.

Performing above steps I am able to set tenant properties to site collection app catalogs even though custom scripts on sites was disabled.

Question :
Can you explain no-script site scenario when we cannot set tenant properties to site collection app catalogs? Does Setting tenant properties to modern or classic site has different behaviour?

Microsoft 365 and Office SharePoint Development
Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,836 Reputation points Microsoft External Staff
    2022-03-01T09:31:20.947+00:00

    @Nikhil Rane

    In the SharePoint admin center, you can choose to disallow users to run custom script on OneDrive (referred to as "personal site") or on all classic team sites they create. After you disable custom script in the SharePoint admin center, it can take up to 24 hours for the change to take effect.

    To disallow custom script on other SharePoint site, you should run following PowerShell in the SharePoint Online Management Shell.

    #Config Parameters  
    $AdminSiteURL="https://crescent-admin.sharepoint.com"  
    $SiteURL="https://crescent.sharepoint.com"  
         
    #Get Credentials to connect  
    $Cred = Get-Credential  
         
    #Connect to SharePoint Online Tenant Admin  
    Connect-SPOService -URL $AdminSiteURL -Credential $Cred  
         
    #sharepoint online enable custom scripts powershell - Disable DenyAddAndCustomizePages Flag  
    Set-SPOSite $SiteURL -DenyAddAndCustomizePages $True  
    

    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.


Your answer

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