Today I had to fix an AD Connect server that stopped working over the weekend. Unfortunately there was now way of fixing AD Connect sync and we had to reinstall AD Connect. However I didn’t want to lose the configuration that was made in the past.
Since the end of 2020 AD Connect saves the history of configurations changes. Each time the configuration is changed from the Azure AD Connect wizard, now when using PowerShell, a new time-stamped JSON settings file is automatically exported to %ProgramData%\AADConnect. The settings file name begins with Applied-SynchronizationPolicy-*.JSON, where the last part of the file name is a time stamp. Example below:
Export the configuration
STEP 1: Run the following script, change the path if needed where the configuration will be stored
C:\Program Files\Microsoft Azure Active Directory Connect\Tools\MigrateSettings.ps1 -ServerConfiguration "c:\AdConnect"
STEP 2: Copy the entire directory to the new staging server or just save it for backup on another server.
Import the configuration
STEP 1: Start the Microsoft Azure Active Directory Connect wizard, click Customize
STEP 2: On the Install required components page, select Import synchronization settings, and select the exported JSON file from the folder and press install. Continue the steps, and you should be good to go.