Copy Immutable ID and Proxy Addresses from Azure to AD

4:58 AM AADSYNC , Dirsync , Office 365 0 Comments

Reuse DirSync in a new server after removing DirSync or in case DirSync server has crashed or no longer working.

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.

Import-Module Msonline

Import-Module ActiveDirectory

$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



If you would like to receive the powershell script please don't hesitate to contact me.

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

Winking smile