How to Enable Custom Scripting in SharePoint Modern Sites


In this post, we will discuss the “Access Denied” error when you try to upload files in the library or try to create a new folder, even when you have full access to site collections.
Error when creating a folder in library:
Error when uploading file:
Scripting capabilities are not enabled with modern sites (and other sites) by default, and cannot be enabled using the admin portal for modern sites.
You can enable custom site scripting using the below PowerShell commands, even if allow custom script is selected from the admin panel. 
  1. Connect-SPOService -Url    
  2. Set-SPOSite -Identity https:// -DenyAddAndCustomizePages 0