Top
SharePoint Logo

Site Collection Administrator access denied when adding solutions


I have recently found myself in a situation, when after creation of a new, Modern Site (it was a modern Team Site) my account, even though that was set to be a SharePoint Administrator (even a tenant one :)) and a Site Collection Administrator wasn’t able to see links to any galleries in the Site Collection settings. Moreover, when accessing them using a direct links and then trying to ex. add a new solution, I was being told, that I have no permissions for that operation.

Usually, this issue was related to the settings in SharePoint Admin Center, from the “Custom Script” section. Both should be set to “Allow”:

Custom Script settings in SharePoint Online

I knew that, this settings when marked using the UI requires even 24 hrs to get enabled (it can be changed immediately only if you use SPO Management Shell) . So I did that once I got the new tenant, days before facing the issue.

I went back to the site, and checked my user’s permissions. I noticed, that I have a “deny” for “Add and Customize Pages”:

Deny for Add and Customize Pages permission in SharePoint Online

But that issue was related ONLY to the Modern Sites. Nothing I faced in classic sites. 

The solution

For me the solution was quite simple. Even though, the settings for “Custom Scripts” are set on the SPO level, it seems that they not influence directly the site collections created using the modern experience. To solve it I used SharePoint Online Management Shell (get it from here), and changed that setting manually for my specific Site Collection:

Connect-SPOService 
Set-SPOSite -Identity https://<your-tenant-name>.sharepoint.com/sites/<your-modern-site-collection-name> -DenyAddAndCustomizePages $false

After you paste that script into the Shell, you will need to provide the URL to your admin site collection and credentials (user must be at least SPO admin).

[tds_info]   The SPO admin site collection, means that one having the URL: https://<your-tenant-name>-admin.sharepoint.com/[/tds_info] 

When script finishes its execution, the “Deny” from my user’s permissions disappeared immediately 🙂


Tomasz Poszytek

Hi, I am Tomasz. I am expert in the field of process automation and business solutions' building using Power Platform. I am Microsoft MVP and Nintex vTE.

2 Comments
  • Andrew Gaskell

    Hi Tomasz
    I had this issue when trying to inject a custom script into a modern site collection. I am tenant admin and site collection admin but I got access denied. It seems the issue is with O365 connected modern site collections. I tested with standalone O365 modern site collections and there was no issue.

    Setting the DenyAddAndCustomizePages flag fixes the issue.

    Thanks
    Andrew

    June 30, 2020 at 9:12 pm Reply

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.