Rozwiązywanie konfliktów synchronizacji AD Connect / Resolving AD Connect synchronization conflicts / ImmutableID

Jeżeli korzystamy z oprogramowania AD Connect do synchronizacji kont lokalnego Active Directory, a wcześniej mieliśmy założone jakiś konta w Azure Active Directory, wówczas wcześniej czy później spotkamy się z konfliktem założenia konta w Azure Active Directory na podstawie konta Active Directory. Zdarzy się to w przypadku, kiedy mamy identyczny UPN w Active Directory i azłożymy konto w Azure Active Directory o takim samym mailu, które będzie miało role Global Administratora. Wówczas AD Connect założy konto w domenie @onmicrosoft.com a do nazwy użytkownika doda kilka cyferek i będziemy mieli konta:

  • mariusz.ferdyn8858@mojadomena.onmicrosoft.com
  • mariusz.ferdyn@mojadomena.pl

Do połączenia (matchowania) kont Azure Active Directory I Active Directory służy atrybut ImmutableID. I mówiąc, krótko musimy ustawić ten atrybut dla już istniejącego konta w Azure Active Directory, poniższą procedurą:

  1. Przenieść użytkwonika w Active Directory do konteneru, który nie jest synchronizwany
  2. Dokonać synchronizacji (Start-ADSyncSyncCycle -PolicyType Delta)
  3. Wyświetlić ImmutableID poleceniem:
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn8858@mojadomena.onmicrosoft.com|fl
  4. Usunąć użytkownika z Azure Active Directory
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn8858@mojadomena.onmicrosoft.com|Remove-MsolUser -RemoveFromRecycleBin
  5. Dokonać synchronizacji (Start-ADSyncSyncCycle -PolicyType Delta)
  6. Wyświetlić parametry istniejącego użytkownika w Azure Active Directory
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn@mojadomena.pl|fl
  7. Ustawić immutableid otzrymane z polecenia 3, poprzez:
    get-MsolUser -UserPrincipalName mariusz.ferdyn@mojadomenapl.pl|Set-MsolUser -ImmutableId “W7gqU22hws4tpsPw==”
  8. Dokonać synchronizacji (Start-ADSyncSyncCycle -PolicyType Delta)

Po powyższym konta powinny być zsynchronizowane prawidłowo, a sama metoda może być stosowana do migracji użytkowników między domenami.


If we use AD Connect software to synchronize Active Directory local accounts, and previously we had some accounts in Azure Active Directory, sooner or later we will meet with the conflict of setting up an account in Azure Active Directory based on the Active Directory account. This will happen if we have the same UPN in Active Directory and set up an account in Azure Active Directory with the same e-mail that have the role of Global Administrator. Then AD Connect will create an account in the @ onmicrosoft.com domain and add a few numbers to the username, so we will have accounts:

  • mariusz.ferdyn8858@mojadomena.onmicrosoft.com
  • mariusz.ferdyn@mojadomena.pl

The ImmutableID attribute is used to connect (match) Azure Active Directory and Active Directory accounts. To merge two accounts, we have to set this attribute for an existing account in Azure Active Directory, with the following procedure:

  1. Move the user in Active Directory to a container that is not synchronizing
  2. Synchronize (Start-ADSyncSyncCycle -PolicyType Delta)
  3. Display ImmutableID with the command:
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn8858@mydomain.onmicrosoft.com|fl
  4. Remove the user from Azure Active Directory
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn8858@mydomain.onmicrosoft.com|Remove-MsolUser -RemoveFromRecycleBin
  5. Synchronize (Start-ADSyncSyncCycle -PolicyType Delta)
  6. View the parameters of an existing user in Azure Active Directory
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn@mydomain.com|fl
  7. Set the immutableid from the command 3, by:
    get-MsolUser -UserPrincipalName mariusz.ferdyn@mojadomenapl.pl|Set-MsolUser -ImmutableId “W7gqU22hws4tpsPw ==”
  8. Synchronize (Start-ADSyncSyncCycle -PolicyType Delta)

After the above, the accounts should be synchronized correctly, and the method can be used to migrate users between domains.