场景:
假设David
是一个仅云端用户,正在使用Office 365 Enterprise E5许可证。当David离开公司时,作为管理员,需要删除他的账户。这种情况下,如果仍需要访问他的邮箱内容,该如何操作呢?
这个需求,可以通过非活动邮箱(Inactive Mailboxes)功能实现。考虑到有些用户对非活动邮箱不熟悉,本文将介绍此操作的具体步骤。
注意:在本文中,我们将提供把邮箱从“活动”状态正确移动到“非活动”状态时的必要步骤。有关如何访问非活动邮箱内容的详细信息,请访问此处。
准备工作:
必须使用PowerShell连接到Azure
Active Directory / Microsoft联机目录服务(MSODS)和Exchange
Online才能完成本文提到的任务。
具体步骤:
1. 将邮箱置于保留状态(如果该邮箱有存档邮箱,也会一并被置于保留状态)。对此,这里使用了诉讼保留(LitigationHold),当然,也可以使用Exchange Online或“安全和合规性”中的任何保留:
Set-Mailbox David -LitigationHoldEnabled $ True -LitigationHoldDuration Unlimited
注意:保留设置最多可能需要60分钟才能生效。
2. 验证是否已启用诉讼保留:
Get-Mailbox David | fl PrimarySMTPAddress, Identity, LitigationHoldEnabled, LitigationHoldDuration, MailboxPlan, PersistedCapabilities, SKUAssigned
用户属性应该显示如下:
PrimarySmtpAddress : David@contoso.com
Identity : David
LitigationHoldEnabled : True
LitigationHoldDuration : Unlimited
MailboxPlan : ExchangeOnlineEnterprise-0527a260-bea3-46a3-9f4f-215fdd24f4d9 PersistedCapabilities : {BPOS_S_O365PAM, BPOS_S_ThreatIntelligenceAddOn, BPOS_S_EquivioAnalytics, BPOS_S_CustomerLockbox, BPOS_S_Analytics, BPOS_S_Enterprise}
SKUAssigned : True
3. 检查当前的许可证总数,和已分配的许可证数量:
Get-MsolAccountSku | fl AccountSkuId,ActiveUnits,ConsumedUnits
可能得到的结果如下:
AccountSkuId:contoso:ENTERPRISEPREMIUM
ActiveUnits:25
ConsumedUnits:3
ConsumedUnits表示当前已分配的许可证数量
4. 删除Azure Active Directory用户,使其对应的邮箱成为非活动状态:
Remove-MsolUser -UserPrincipalName David@contoso.com
5. 验证邮箱是否已删除,并成为非活动邮箱:
Get-Mailbox David -InactiveMailboxOnly | fl PrimarySMTPAddress, Identity, LitigationHoldEnabled, LitigationHoldDuration, SKUAssigned, IsInactiveMailbox, IsSoftDeletedByRemove, WhenSoftDeleted
结果应该类似于:
PrimarySmtpAddress : David@contoso.com
Identity : Soft Deleted Objects\David
LitigationHoldEnabled : True
LitigationHoldDuration : Unlimited
SKUAssigned : False
IsInactiveMailbox : True
IsSoftDeletedByRemove : True
WhenSoftDeleted : 6/4/2018 6:42:11 AM
6. 检查Azure Active Directory用户是否已被删除(应该可以在已删除用户列表中看到,也可通过运行类似下面的命令查看):
Get-MsolUser -ReturnDeletedUsers -All | where {$_.ProxyAddresses -match "David@contoso.com"} | fl UserPrincipalName, IsLicensed, Licenses
结果应类似于:
UserPrincipalName : David@contoso.com
IsLicensed : TrueLicenses : {contoso:ENTERPRISEPREMIUM}
7. 再次检查许可证总数和已分配的许可证数量(对于已经删除的用户,他的许可证也会被释放出来):
Get-MsolAccountSku | fl AccountSkuId, ActiveUnits, ConsumedUnits
结果应该如下:
AccountSkuId : contoso:ENTERPRISEPREMIUM
ActiveUnits : 25
ConsumedUnits : 2
可选步骤(如果要永久删除该Azure Active Directory用户)
8. 等待30天,使该Azure Active Directory用户自动从“已删除用户”列表中被删除,或者运行以下命令永久删除该用户:
Get-MsolUser –ReturnDeletedUsers -All | where {$_.ProxyAddresses -match "David@contoso.com"} | Remove-MsolUser -RemoveFromRecycleBin
9. 检查用户是否仍然存在于活动用户或已删除用户列表中(对于下面两个命令,不应该返回任何结果):
Get-MsolUser -All | where {$_.ProxyAddresses –match David@contoso.com”}
Get-MsolUser -ReturnDeletedUsers -All | where {$_.ProxyAddresses -match "David@contoso.com"}
10. 验证已删除Azure Active Directory用户的邮箱是否仍处于非活动状态,并启用了诉讼保留:
Get-Mailbox David -InactiveMailboxOnly | fl PrimarySMTPAddress,LitigationHoldEnabled,LitigationHoldDuration,SKUAssigned,IsInactiveMailbox
结果应类似于:
PrimarySmtpAddress : David@contoso.com
LitigationHoldEnabled : True
LitigationHoldDuration : Unlimited
SKUAssigned : False
IsInactiveMailbox : True
参考文献:
英文版(该文原始出处):
https://blogs.technet.microsoft.com/exchange/2019/01/29/how-to-work-with-inactive-mailboxes/