This is a normal case in SharePoint inside Office 365. If you have a new tenancy and you can’t edit the root site collection in SharePoint designer, that’s because editing that root site collection is disabled by default.

You should go to SharePoint Admin Center, click on settings, and in the section for custom scripts, you should enable the scripts for the self-service created sites. This is considered as a security feature in SharePoint when it comes to Office 365.

If you go to SharePoint Online Admin Center you can allow Custom Scripts on sites which will activate the missing features. In order to do this go to SharePoint Admin Center  ->Settings. Then Select ‘Allow Users to run custom script’ radio buttons.

Enable SharePoint Designer for SharePoint Online

Enable SharePoint Designer for SharePoint Online

However, selecting allow custom script won’t be enabled until the timer job runs which will happen as per SharePoint Online settings,  a time period of 24 hours will be required for this to take effect (normally its less).  If we can’t wait that long we can get this activated using PowerShell for SharePoint Online.

PowerShell enable script

In order to execute PowerShell commands against SharePoint online, first we have to establish a connection with SharePoint Online. Noted that, you need download and install the latest SharePoint Online Management Shell. If you already have a previous version installed, uninstall it first and then install the latest version. The latest version can be downloaded here https://www.microsoft.com/en-us/download/details.aspx?id=35588

Connect-SPOService
Set-SPOsite "https://yourtenant.sharepoint.com/sites/sitename" -DenyAddAndCustomizePages 0

2018-06-29_10-03-03

2018-06-29_10-06-21

Enable customization for SharePoint

You also need to wait for sometime – normally less than 1 hour. Then you can use SharePoint designer to access and customize masterpage and use custom scripts.