Step 3

Delete and purge the users

Delete the old accounts, check the recycle bin holds them all, then purge them.

10 minutesOld tenant, User Administrator or above

Delete them

PowerShell
Connect-MgGraph -TenantId old.contoso.com -Scopes "User.ReadWrite.All","User.DeleteRestore.All","Group.ReadWrite.All" -NoWelcome
$old = Get-MgUser -Filter "endswith(userPrincipalName,'@lab.contoso.com')" -All -ConsistencyLevel eventual -CountVariable c
"$($old.Count) users found"    # must match your inventory
$old | ForEach-Object { Remove-MgUser -UserId $_.Id; "deleted $($_.UserPrincipalName)" }
(Get-MgDirectoryDeletedItemAsUser -All | Where-Object UserPrincipalName -like '*lab.contoso.com').Count

Deleted accounts sit in the recycle bin for 30 days and still count as using the domain. Microsoft adds the object ID to the front of each name, which is why the last line matches on *lab.contoso.com.

Purge them

PowerShell
Get-MgDirectoryDeletedItemAsUser -All | Where-Object UserPrincipalName -like '*lab.contoso.com' |
  ForEach-Object { Remove-MgDirectoryDeletedItem -DirectoryObjectId $_.Id; "purged $($_.UserPrincipalName)" }
(Get-MgDirectoryDeletedItemAsUser -All | Where-Object UserPrincipalName -like '*lab.contoso.com').Count    # 0
No undo

Purged accounts cannot be restored. The CSV from the inventory page is the only record left.

Your progress is kept in this browser only.