Azure AD Connect – Getting “An error occurred while connecting to the state store” error after updating AAD connect configuration

Recently I had to update the configuration of an existing Azure AD Connect – the directly synchronization tool from Microsoft to synchronize your Active Directory identities to Azure AD – instance.

It was running the latest version at that time (1.5.42).

The error was:

An error occurred while connecting to the state store: Attempted to perform an unauthorized operation

It did not matter which type of configuration update I tried, I was always getting the error after completing the Azure AD Connect configuration wizard (when clicking the Configure button at the last step ‘Ready to configure’).

Then I noticed that a new version was released (1.5.45), s before further investigation and obviously opening a service request I upgraded the instance but still no luck.

It ended to be a permission issue on on file used by Azure AD Connect (PersistedState.xml located in C:ProgramDataAADConnect)

To fix the issue, first take ownership of the file and then edit the permission to grant the Azure AD Connect service account full control.

Then you can run again the wizard to update your configuration and…Tada! Issue fixed.