Remove-SPOSite Access denied You do not have permission to perform this action or access this resource

In this post, we will discuss how we can resolve the below issue which comes when tries to delete a SharePoint online site using PowerShell. I was trying to delete a site collection from SharePoint by using PowerShell.

Below is the command which I was using.

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://onlysharepoint2013-admin.sharepoint.com -credential [email protected]

Remove-SPODeletedSite -Identity https://onlysharepoint2013.sharepoint.com/sites/MySite -Confirm:$false

But it gave me below error:




Remove-SPOSite Access denied You do not have permission to perform this action or access this resource

POowerShell online Remove-SPOSite Access denied
POowerShell online Remove-SPOSite Access denied

Solution:
The problem was that the account I was using. The account should be a site collection administrator for the site which you are going to delete. After I add the user to the site collection administrator, I was able to delete the site collection.

Hope this might help someone.

>