Starting with version 184.108.40.206 of Azure AD Connect we have the great improvement of having a 30minute sync schedule as default in via the new scheduler.
If you’ve been running on SQL express, you might have run in to a problem where the sync engine won’t run because of space issues. Something that didn’t happen with prior versions.
So, what has changed? Why is it using more space than before?
What it all comes down to is the new sync interval, what makes it fill the SQL express database is the logging tied to each sync.
Prior to this update the sync ran every 3hours as default, now it is every 30minutes, so effectively for every 3hours we now run it 6 times instead of just 1
Each run we generate a log entry with what changes that has been done and any errors encountered in the sync.
We generate a lot of more data in the same amount of time than we used to do, so, how do we solve this? Either you could transition to using a real SQL server, but that costs money. Then the database would be allowed to grow above 10GB that is the current limit for SQL express. The other thing you can do to remedy this is to lower the amount of days the logs will be kept for, the standard value for this is 7days.
Here is a great post from Andreas Kjellman on the functions of the new scheduler of AAD Connect https://azure.microsoft.com/en-us/documentation/articles/active-directory-aadconnectsync-feature-scheduler/
You can find a lot more information there, highly recommend to read through it all.
There we can find that there is a setting that specifies how long you want to keep the logs, specifically:
“•PurgeRunHistoryInterval. The time operation logs should be kept. These can be reviewed in the synchronization service manager. The default is to keep these for 7 days.”
So, using powershell we can change this setting to make it fit our database constraints.
In this example we will set it to keep the data for 3 days instead.
To do this we would run:
Set-ADSyncScheduler -PurgeRunHistoryInterval 3.00:00:00
Remember, databases don’t shrink on disk just because you purge data from it, it just gets whitespace that can be used for future writes.