In order to do so you will have to launch Azure powershell in admin mode and connect to MSOL service as in the following snapshot
$cred = get-credential
After connecting then type/copy the following
Get-MsolUser -ReturnDeletedUsers -All | Out-GridView
Once you type enter a GUI will come up showing you all the deleted users list, you should delete any old non-usable account that has similar attributes to the ones that you’re about to Sync from the AD to O365.
Once you’re sure about what do you want to delete you can go ahead with the following Command to delete the users
You must be sure that when you run this command, you will no longer be able to restore any deleted item or object later on.
Get-MsolUser -ReturnDeletedUsers -All | Remove-MsolUser -RemoveFromRecycleBin -Force –Verbose
Now you should run the following Script on the same open powershell in order to start the copying process.
$cred = Get-Credential
Connect-MsolService -Credential $cred
$onlineusers = Get-MsolUser -All
$adusers = Get-ADUser -Filter *
Press enter and when you want you get prompted to select an option choose 1 and enter
After the copy is finished you can match for yourself the list of ImmutableID along with the GUID
Ldifde -f dump.txt
Hope you find this useful coz I did