"出现错误"错误,并且域删除Office 365

备注

Office 365 ProPlus 正在重命名为 适用于企业的 Microsoft 365 应用。 有关此更改的详细信息, 请阅读此博客文章

症状

在使用 Remove-MsolDomain -domain name domain.com PowerShell cmdlet 从 Office 365 中删除域时,您将收到以下错误消息:

"发生错误"

详细信息

当应用程序使用 IdentifierURIs Azure Active Directory要删除的域时,将发生此错误。 可以通过运行以下 cmdlet 来检索引用域的应用程序列表。

重要

此 cmdlet 要求安装适用于Azure Active Directory 的 PowerShell Graph。

Get-AzureADApplication | Where-Object -Property identifieruris -Match '<domain to remove>' 

注意 在此命令中, <domain to remove> 将 替换为要删除的域。

解决方案

若要解决此问题,请更新 identifierURIs 属性以引用租户的 .onmicrosoft.com 域。 在每个引用域的 Azure AD中执行此操作。

若要进行替换,请使用以下 cmdlet:

$apps=Get-AzureADApplication | Where-Object -Property identifieruris -Match '<domain to remove>'

$apps | foreach {$newid=$_.IdentifierUris -replace "<domain to remove>","<tenant name>.onmicrosoft.com";Set-AzureADApplication -ObjectId $_.objectid -IdentifierUris $newid}

重要

在此命令中,将 替换为要删除的域和租户 onmicrosoft.com <domain to remove> <tenant name> .onmicrosoft.com 域。