Sometimes, especially when developing custom SharePoint Add-ins, we want to host assets (JavaScript, CSS, etc.) in Master Page Gallery.
This is a pretty standard approach that allows to reference the same resources from sub sites (I know that sub sites are now evil =)) but store everything in one place on root level of the site collection.
Note: it is not necessary to host your assets in Master Page Gallery, it is one of the options. So, take it in mind, that you can use other options as well.But what if we want to use that approach with Modern Team Sites?

First of all, you won't see Master pages menu item in Site Settings on Modern Team Site:

Well, okay, it's not a big deal as we know the url of the library: _catalogs/masterpage/Forms/AllItems.aspx
This url works and you are redirected to the standard Master Page Gallery:
Now, if you try to create a folder here or upload a new file you'll get "Access Denied" error even if you are a Site Collection Admin:
Uploading a file:

Adding a folder:

So, let's go to Library Settings -> Permissions for this document library (permissions are inherited) -> Check Permissions.
The result of the permissions' check will look like that:

So, there is a "Deny" rule that restricts access to Master Page Gallery. And this rule is not a part of any Permission levels available on the site collection.
Actually, it's a site collection setting called DenyAddAndCustomizePages.
And we can change it using SharePoint Online Management Shell:

Connect-SPOService https://&ltyourtenant>
Set-SPOSite -Identity https://<yourtenant><team-site> -DenyAddAndCustomizePages $false
After that the permissions in Master Page gallery work as expected and the Deny rule is gone.
Interesting thing that DenyAddAndCustomizePages is equal to no-script option - read the next article for details.
And that's it for today!

Have fun!