How to sync Azure AD user data to a headless CMS (Sanity) for use in a Next.js site?

James Trenda 0 Reputation points
2025-04-22T03:12:46.3833333+00:00

Hi all,

I’m working on a potential project for a Microsoft 365 customer who uses Azure Active Directory (Entra ID) to manage their employee data. I’m considering using Sanity (a headless CMS) to power a new Next.js-based website that will include employee profile pages.

I’m new to the Microsoft 365 ecosystem and Graph API, and I’m wondering if there’s a recommended way to trigger a webhook or run a function whenever an employee is created, updated, or deleted in Azure AD. My goal is to use Azure AD as the single source of truth for core identity data—things like name, title, department, and email—and then sync that data into Sanity as structured documents.

In Sanity, editors could then enrich these records with custom content fields like bios, photos, or tags (e.g. “featured employee”). Ideally, I’d like to keep the AD data read-only and only expose the editorial fields in the CMS.

Is there a standard approach to syncing AD user data with external systems like this? I’d love any guidance on:

  • Triggering CUD events from Azure AD
  • Best practices for one-way syncing to an external system like a CMS
  • Anything to watch out for in terms of permissions, webhooks, or latency

Thanks in advance!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,593 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.