This page explains how to set up recurring cache refresh jobs when you have large volumes of users, groups, or sites in your tenant.
The Cache Update job leverages the ability of the Refresh function to use a single delta query to identify object changes in Entra.
For large environments, it is recommended to schedule separate jobs for users, groups, and sites. This improves performance and makes it easier to see which area (users, groups, or sites) may need attention if a job runs longer than expected, since each job sends an email report that includes its run duration.
If you have not yet loaded all your data into the cache (for example, you’ve never loaded Users, Groups, or Sites), you can build an initial cache with complete data by configuring two jobs with different options.
Here’s a summary of the steps:
-
First create the cache with one-time initial load of basic properties (may long time) to populate the cache. Unless you already launched manually Users, Groups, etc. This has to be done once. Depending on the size, it could take several minutes (for example about 12-15 minutes for 80,000 users) to a few hours (for example, when dealing with a tenant with a few hundred thousand users).
-
Then, set up a one-time high-frequency recurring job that runs in limited batches to fully (all additional data) load all existing objects into the cache without overwhelming your machine’s processing power or memory. This additional load takes longer because multiple queries are executed for each object, which is why it is broken into batches. Running the cache update job in batches also reduces the impact of outages or failures, since only the current batch is affected and the next batch can resume building the cache.
-
Then, schedule a recurring refresh job at your desired frequency (for example, daily or several times per day) to maintain a valid delta link. The delta link lets sapio365 refresh only what has changed, so updates are much faster and you avoid having to reload everything. This ensures you are always working with fresh data.
This approach lets you handle the heavy initial load once, and then rely on efficient, incremental updates to keep your cache current.
Recommendations for tenants with strict Conditional Access policies
If your Conditional Access policies make it hard to reuse credentials (for example, because of frequent MFA prompts or short-lived tokens), we recommend creating an App session.
You’ll need to:
-
Create an App session with app-only credentials based on a registered application and certificate, and shared cache parameters.
-
Use that app-only session in your scheduled jobs so they are not affected by user-based MFA, token revocation, or interactive sign-in requirements.
This approach follows Microsoft’s general guidance to use workload identities and certificate-based credentials for automation in tenants with strong MFA and Conditional Access enforcement, instead of relying on user accounts that require interactive sign-ins.
1 - Create the cache
Before setting up the Cache Update job for users, the users cache must first be created. You can do this by launching Users from the Dashboard if you haven’t already done so. Depending on the size of your tenant, this initial load may take several minutes to complete.
For hybrid tenants, once you load the on-prem attributes you select in Users, the on-prem users cache will be created. This ensures that subsequent cache updates can reuse that on-prem data without having to reload it for all users each time.
2 - Set up a high-frequency one-time limited batch job to load any data that was not loaded (missing)
Now that the cache has been created, set up a job that runs in batches to fully load all existing objects' properties into the cache. This load takes longer because multiple queries are executed for each object. Since querying 10,000 objects is more demanding on a machine’s memory and performance than doing several smaller loads, running this job in batches lets you build the cache incrementally.
What batch size to set?
The bigger the batch size, the faster the cache will be built, but the more taxing the job will be on your machine. The goal is to find the right balance based on your machine’s processing power and available memory.
For example, based on our tests, loading every additional property for a batch of 1,000 users takes at least 1 hour. For a tenant with 10,000 users, initially scheduling this batch job to run every 2 hours (to avoid overlap) would build up a totally complete cache in about 20 hours.
Schedule a one-time job to check duration
If you’re not sure how long a certain batch size will take, run the job with that batch size as a one-time schedule. You’ll receive an email report of its run duration, which you can use to adjust the batch size and recurrence to better fit your environment.
3 - Change the frequency of the scheduled job
Once every object has had all its complete properties loaded and is available in the grid, you can modify the job’s run frequency to run daily.
This recurring job refreshes only the properties of objects that were detected as changed in Entra, which significantly reduces the number of queries and the time required to update the cache. The idea is that any sapio365 user can quickly refresh data whenever needed, without having to reload everything.
The simplest way to do this is to change the schedule frequency of the job created in Step 2 from Hourly to Daily in sapio365.