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
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.
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com