Donnerstag, 21. Juli 2016

Azure AD Connect "A deadlock occurred in SQL Server"

Hi all, 
today I would like to show you an error message that I got yesterday in the new Azure AD Connect version when trying to change a sync rule in the new Sync Rule Editor.
I started with changing a default rule and the wizzard notified me to create a copy of the sync rule and disable the default rule. 
When I created the clone of the sync rule I changed the precedence of the rule to the same value as the initial default rule. The precedence value defines the order the sync rules are applied.
In my little stupid mind I thought (yes, thinking is not something I do on a regular basis) I could and should use the same precedence value to avoid changes to the synchronization sequence.

When trying to create the new rule I allways got the error message "A deadlock occured in SQL Server while trying to acquire an application lock."


The error occures due to the fact that the new rule is created before the old rule is disabled.
I solved the problem by setting the precedence value to the highest available value to create the clone of the rule and then change the precedence value of the disabled rule to the next highest value. Last step was to change the value of the clone back to the initial one.
Let me make an example:

  • Highest available precedence value - 184
  • Initial precedence value - 179
  • Sync rule clone created with precedence 184
  • Change disabled default sync rule precedence to 185
  • Change sync rule clone precedence back to 179
Hope this helps.

Keep on syncing
Chris