在 PowerShell 中使用 Remove-PnPTenantSite 删除 SharePoint 站点不起作用

Remove SharePoint Site with Remove-PnPTenantSite in PowerShell not working

我想使用 Remove-PnPTenantSite 通过 PowerShell 删除 SharePoint 网站。 这不起作用,因为我的网站仍然是 Office 365 组的一部分,我必须先删除它。 要删除 Office 365 组,我必须获取统一组。 我尝试使用 Get-PnPUnifiedGroup,但抛出了这个:

Get-PnPUnifiedGroup : Exception while invoking endpoint https://login.microsoftonline.com/TOKEN/oauth2/token.

让这两种方法中的一种起作用已经很有帮助了, 提前致谢!

我必须创建一个具有 Microsoft-Graph-Api 权限的应用程序,使用应用程序凭据在线连接 pnp,然后删除统一组,使用普通凭据连接,然后删除站点:

Connect-PnPOnline -AppId AppID -AppSecret AppSecret -AADDomain Domain
Connect-PnPOnline -Url $siteUrl -Credentials $cred
Remove-PnPUnifiedGroup -Identity Title
Remove-PnPTenantSite Url -Force