I’ve just recently come across an issue when performing the upgrade procedure for the Microsoft Azure Directory Sync tool with a remote SQL database. The procedure seems simple enough at first glance and is documented here.
To break down the process it is only a few simple steps:
Install the new dirsync –
Dirsync.exe /fullsql
Click next on the upgrade wizard until complete
Run Powershell –
Import-Module DirSync
Run the following PowerShell cmdlet to update the backend database –
Install-OnlineCoexistenceTool -UseSQLServer –SqlServer <ServerName> -Upgrade -Verbose -ServiceCredential (Get-Credential)
The Issue
This particular issue will occur during the upgrade procedure on the PowerShell step Install-OnlineCoexistenceTool with the following error –
VERBOSE: Running InstallOnlineCoexistenceTool in Upgrade mode.
Install-OnlineCoexistenceTool : The SQL Server Instance specified during an upgrade must match the previously
configured SQL Server Instance. Expected SQL parameter for upgrade were Server: Instance:
At line:1 char:1
+ Install-OnlineCoexistenceTool -UseSQLServer -SqlServer servername …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Onlin…CoexistenceTool:InstallOnlineCoexistenceTool) [Inst
all-OnlineCoexistenceTool], DirectorySyncInstallException
+ FullyQualifiedErrorId : 201,Microsoft.Online.Coexistence.PS.Install.InstallOnlineCoexistenceTool
The first time I got this error, I assumed that I had provided incorrect syntax for the cmdlet and proceeded to try every variant possible. Nothing seemed to satisfy the shell so I started to look elsewhere. Next step along the process was to go look at the possible FIM configuration settings listed in the registry that I knew of –
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FIMSynchronizationService\Parameters
I found the two keys that I ‘presumed’ that the cmdlet was using for verification –
Server = <Server FQDN>
SQLInstance = <blank>
Based on these two key values I then went back to my shell and tried to enter the syntax exactly as I could see it. I thought that maybe because my ‘SQLinstance’ value was empty, PowerShell was finding it hard for me to process this in the cmdlet of a null value. To cut a long troubleshooting story short, it didn’t matter. I had stared at the cmdlet long enough and resided to the fact that it wasn’t happy about the values stored elsewhere, and I wasn’t going to find them any time soon.
Cause
There was an issue in previous versions of DirSync where the following two registry keys were not written when installed using the /FullSQL flag –
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOLCoExistence\storeserver
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOLCoExistence\SQLINSTANCE
DirSync attempts to read these keys when performing the in-place upgrade to verify the SQL Server and Instance name, and then the upgrade fails when it cannot find them.
Solution
Copy value data from key –
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FIMSynchronizationService\Parameters\Server\<ServerName>
Create a new string value of –
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOLCoExistence\storeserver
Paste the value data from above
Copy value data from key –
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FIMSynchronizationService\Parameters\SQLInstance
Create a new string value of –
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOLCoExistence\SQLINSTANCE
Paste the value data from above (if any)
Note: For me this key was blank as the default instance was being used not a named instance.
Re-run cmdlet –
Install-OnlineCoexistenceTool -UseSQLServer –SqlServer <ServerName> -Upgrade -Verbose -ServiceCredential (Get-Credential)
Expected Output –
PS C:\Windows\system32> Install-OnlineCoexistenceTool -UseSQLServer -SqlServer <SQL Server NAME> -Upgrade -Verbose -ServiceCredential (Get-Credential)
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
VERBOSE: Running InstallOnlineCoexistenceTool in Upgrade mode.
VERBOSE: Skipping Microsoft SQL Server 2012 SP1 Express installation.
VERBOSE: Upgrading Microsoft Forefront Identity Manager
VERBOSE: AbandonKeys: C:\Program Files\Windows Azure Active Directory Sync\SYNCBUS\Synchronization Service\Bin\miiskmu.exe /q /a
VERBOSE: AbandonKeys: C:\Program Files\Windows Azure Active Directory Sync\SYNCBUS\Synchronization Service\Bin\miiskmu.exe /q /a ExitCode:0
VERBOSE: Uninstalling msiexec.exe /quiet /l miisUninstall.log /x {C9139DEA-F758-4177-8E0F-AA5B09628136}
REBOOT=ReallySuppress…
VERBOSE: Please wait while the Synchronization Engine is uninstalled.
VERBOSE: The Synchronization Engine was successfully removed. Msiexec /x returned 0.
VERBOSE: Installing msiexec.exe /quiet /l “C:\Program Files\Windows Azure Active Directory Sync\miissetup.log” /i “C:\Program Files\Windows Azure Active Directory Sync\SynchronizationService.msi” INSTALLDIR=”C:\Program Files\Windows Azure Active Directory Sync\SYNCBUS” storeserver=<servername> serviceaccount=<credentials> servicedomain=<domain> groupadmins=FIMSyncAdmins groupoperators=FIMSyncOperators groupbrowse=FIMSyncBrowse groupaccountjoiners=FIMSyncJoiners grouppasswordset=FIMSyncPasswordSet servicepassword=<Hidden>
REBOOT=ReallySuppress…
VERBOSE: Please wait while the Synchronization Engine is installed.
VERBOSE: The installation of the Synchronization Engine was successful. Setup returned 0.
VERBOSE: The Synchronization Engine was installed successfully.
VERBOSE: Installing msiexec.exe /quiet /lv “C:\Program Files\Windows Azure Active Directory Sync\MSOIDCRLSetup.log” /i “C:\Program Files\Windows Azure Active Directory Sync\Msoidcli.msi” REBOOT=ReallySuppress…
VERBOSE: Please wait while the Microsoft Online Services Sign-in Assistant service is being installed.
VERBOSE: The Microsoft Online Services Sign-in Assistant service installation succeeded. Setup returned 0.
VERBOSE: The Microsoft Online Services Sign-in Assistant service was installed successfully.
VERBOSE: Installing msiexec.exe /quiet /lv “C:\Program Files\Windows Azure Active Directory Sync\dirsyncUpgrade.log” /i “C:\Program Files\Windows Azure Active Directory Sync\DirectorySync.msi” TARGETDIR=”C:\Program Files\Windows Azure Active Directory Sync\” REBOOT=ReallySuppress…
VERBOSE: Please wait while the Directory Sync tool is installed.
VERBOSE: The Directory Synchronization tool install succeeded. Setup returned 0.
VERBOSE: The Directory Synchronization tool was installed successfully.
Once again we must make a big thankyou to Yaran at Microsoft PSS for helping me resolve this issue.