Sunday, August 10, 2014

How to do Hard match in Dirsync?

There are 2 types of matching we do during Dirsync
  1. Soft Match
  2. Hard Match

In this post we will see how to do Hard Match in Dirsync.

Here are the broad level steps that we do to implement Dirsync between on-prem and cloud
  • Get the ObjectGuid from the onpremise for the user
  • Rearrange the ObjectGuid
  • Convert the ObjectGuid to an ImmutableID
  • Update the cloud user with the Immutable ID
  • Run Dirsync


Get the ObjectGuid from the onpremise for the user
  • Go to Adsiedit.msc
  • Right click ADSI Edit and say Connect to and select "Default naming context"
  • Double click the Domain partition and navigate to the OU the concerned user is present and select the user properties
  • Copy the value of ObjectGuid to a notepad



Rearrange the ObjectGuid as shown below
ObjectGuid  :                                                                   44 31 E2 46 77 83 3E 48 A8 7E B6 76 9D B6 2E ED
Group the GUID as shown here:                                     44 31 E2 46 77 83 3E 48 A8 7E B6 76 9D B6 2E ED
Rearrange Hexa bits within the group as done Here:    46 E2 31 44 83 77 48 3E A8 7E  B6 76 9D B6 2E ED
Write the rearranged Bits as shown here :                     46E23144-8377-483E-A87E-B6769DB62EED
Convert the ObjectGuid to an ImmutableID
Now that we have the object Guid in the format we want  download the script from the link below that converts Object Guid to Immutable ID and vice versa
Right click on the downloaded Script and click properties and say Unblock


Now open a Windows powershell navigate to the place where the Script was saved
Invoke the script and pass the Guid ID we got from the above step
PS C:\Users\praveen\Desktop\CAP\Immutable ID> .\GUID2ImmutableID.ps1
Value provided not in GUID or ImmutableID format.
Please Supply the value you want converted
Examples:
To convert a GUID to an Immutable ID: GUID2ImmutableID.ps1 '748b2d72-706b-42f8-8b25-82fd8733860f'
To convert an ImmutableID to a GUID: GUID2ImmutableID.ps1 'ci2LdGtw+EKLJYL9hzOGDw=='

PS C:\Users\praveen\Desktop\CAP\Immutable ID> .\GUID2ImmutableID.ps1 46E23144-8377-483E-A87E-B6769DB62EED
ImmutableID
-----------------
RDHiRneDPkiofrZ2nbYu7Q==



Update the cloud user with the Immutable ID
Now open Windows Azure Powershell for Office 365  and run the below command
Set-MsolUser -UserPrincipalName User@domain.com -ImmutableId RDHiRneDPkiofrZ2nbYu7Q==
 
Here  User@domain.com is the UPN of the user who is in cloud and we want to sync the on-premise user to sync to.

Run Dirsync
Now force an Dirsync to connect the users 
Note: Due to replication and delay in onprem and cloud we might have to wait for some time and force Dirsync couple of times.