1.Whether this issue happens to all the site collections or just one specific site collection? Please make sure you have Designer, Owner, or Administrator permission to the target site collection or web site. If you also get error message:403 forbidden, you could try to install SharePoint designer SP1 64-bit or SharePoint designer SP1 32-bit. And you could try the following codes to enable custom script to solve this problem.
PowerShell codes:
Connect-SPOService -url https://YourO365Domain-admin.sharepoint.com
Set-SPOSite https://YourO365Domain.sharepoint.com/sites/YourSiteCollection -DenyAddAndCustomizePages 0
2.To solve “Untrusted repository” you could use the following PowerShell codes first before installing Microsoft.Online.Sharepoint.Powershell.
PowerShell codes:
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.