Today I was working on some customizations in SharePoint Online and I needed to add files to the Master Page Gallery. I could add folders, but when I tried to upload files I got an Access Denied message “Sorry, you don’t have access to this page”:
First I checked if the scripting capabilities were turned on, that was the case:
I also checked my authorizations on SharePoint Online, I was Site Collection Administrator. But still I did not have the permisson to add a file to the Master Page Gallery. When I checked the permissions on the Master Page Gallery itself, I noticed a Deny Permission:
It seems that the Custom Script settings in the SharePoint Online Management portal did not reflect the current configuration. To enable scripting on a particular site collection immediately, run the following PowerShell command:
Hopefully you will fix this issue faster than I did using this blogpost!