'How to remove OneDrive Business folder using PowerShell

In our tenants we use MFA so I have to connect using SPOService instead onf Connect-PNPOnline. I'm trying to delete my OneDrive Business folder and subfolder but not sure how to delete it so I would be really appreciated if I can get any help or suggestion.

//connect to SharePoint Admin
Connect-SPOService -Url https://company-admin.sharepoint.com/

//My personal OneDrive link
$drive= "https://company-my.sharepoint.com/personal/yzqpsn_nam_corp_com/"
$folder = 'Testing'

Remove-PnPFolder -Name $drive -Folder $folder

If I run this script, it saying I'll need to connect-PnPOnline first but I can't use it since I need to access via MFA. I'm stuck so any suggestion?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source