Hi there
I got the following error trying to solve an issue this morning for a migration where the same username was being used with different UPN and as a guest account
- thiago.beier@tecbis.com.br
- thiago.beier@#guestemail
The quick fix to these errors is:
Permanent delete the user from recycle bin
Log on Office 365 tenant with PowerShell
Connect-MsolService
list all deleted users (user on recycle bin)
Get-MsolUser –ReturnDeletedUsers | FL UserPrincipalName,ObjectID
permanent delete all users from recycle bin
Get-MsolUser –ReturnDeletedUsers | Remove-MsolUser –RemoveFromRecycleBin –Force
I also cleaned up all deleted Groups we had on the Office 365 tenant as well
Connect-AzureAD
logged at your Office 365 tenant with Powershell (used to fix the deleted users before)
list all deleted groups
Get-AzureADMSDeletedGroup
permanent delete all groups from recycle bin
Get-AzureADMSDeletedGroup | Remove-AzureADMSDeletedDirectoryObject
Screenshots collected
Error trying to create a shared mailbox

Connect Office 365 – PowerShell and list deleted users (from recycle bin)

You might see this error / warning if the user thiago.beier appears with the same UPN (UserPrincipalName) more than once.

User the | FL UserPrincipalname,ObjectId to identify multiple entries

Now with the ObjectId you should be able to remove the proper user

You can also remove all thiago.beier (same UPN) @ all domains you might have on recycle bin

Listing all users by UPN and ObjectId

Nuke them all if needed

Check for the deleted users at the Office 365 Portal

Working with deleted Groups

before


Nuke them all running the following:
“Get-AzureADMSDeletedGroup | Remove-AzureADMSDeletedDirectoryObject“
after

References
https://docs.microsoft.com/en-us/powershell/module/msonline/remove-msoluser?view=azureadps-1.0
Check my Github repository
Thanks,