Sync / roster
Provision and keep identities in sync from on-prem Active Directory / LDAP into Microsoft Entra ID, mapping attributes and group membership.
Moving identity to the cloud rarely means turning off the directory everything on-prem still trusts. Attributes, group membership, and lifecycle events have to flow reliably from AD/LDAP into Entra ID, with conflicts and deprovisioning handled. This integration maps the attribute schema, keeps membership in sync, and makes joiner/mover/leaver events propagate correctly.
A working piece from this integration — no sign-up. The full build handles the edge cases, safeguards, and cutover.
// LDAP scoping filter (find enabled users in on-prem AD) (&(objectClass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2))) // Source attribute → Target attribute mapping (Entra ID provisioning) givenName → name.givenName sn → name.surname mail → mail sAMAccountName → onPremisesSamAccountName objectGUID → onPremisesImmutableId (Base64-encoded) memberOf → transitiveMemberOf (group sync) userAccountControl → accountEnabled (bit 2 = disabled) // Entra ID Connect sync rule (onPremisesSyncEnabled = true enables provisioning) userAnchor: objectGUID → immutableId matching:onPremisesSamAccountName+userPrincipalNamesuffix match
How we'd take this from discovery to a production-safe cutover — the phases, the canonical mapping, and the edge cases that bite.
Synchronising identities from on-premises Active Directory (or generic LDAPv3 directory) into Microsoft Entra ID (formerly Azure AD) is the foundational identity plane for Microsoft 365, Teams, Intune, and SaaS SSO. The integration uses Microsoft Entra Connect (or its cloud-native successor, Entra Connect Cloud Sync) as the provisioning engine, running on a staging server inside the perimeter. LDAP queries filtered by OU and attribute scope feed a delta-sync pipeline that writes users, contacts, and group memberships into the Entra ID tenant. The following pathway takes a typical green‑field deployment from environment discovery through production cutover.
AzureADConnect.msi on a dedicated Windows Server 2016+ staging/production server. Choose Express Settings for a guided path or Custom to define OU scope explicitly. In the filtering page, select only the OUs that contain identities destined for the cloud — exclude service accounts, system containers, and any OU holding legacy accounts that must never appear in Entra ID. Enable Directory extension attribute sync only if custom attributes are required, as each extension consumes a schema slot in Entra ID.userPrincipalName → userPrincipalName, sAMAccountName → onPremisesSamAccountName, and objectGUID → sourceAnchor (binary-to-string encoded as Base64). Add precedence rules for mail vs. userPrincipalName as the sign-in name. For groups, ensure the groupType bitmask is interpreted correctly so that Security groups and Distribution groups are created as appropriate Entra ID group types — mail-enabled Universal Distribution groups become Microsoft 365 groups if Exchange Hybrid is configured.Add user and Update user events. Confirm group memberships match the on-premises memberOf attribute by exporting both datasets and running a diff.SyncError metric in Entra ID diagnostics — threshold of zero for the first 30 days post-cutover.| AD / LDAP Attribute | Entra ID Attribute | Mapping Rule / Notes |
|---|---|---|
objectGUID (binary) |
sourceAnchor |
Immutable anchor; encoded as Base64 string. Must be stable across rename and move operations. Never change after initial sync. |
userPrincipalName |
userPrincipalName |
Default sign-in name. Entra ID appends the default domain (e.g. .onmicrosoft.com) when UPN suffix is not a verified custom domain. |
sAMAccountName |
onPremisesSamAccountName |
Stored for reference; not used for sign-in unless configured inAlternate ID. |
mail |
mail |
Maps directly. If absent, userPrincipalName is used as a fallback for the mail property. |
displayName |
displayName |
Mandatory for all user and group objects. Default rule supplies a Const transform of "N/A" only when the attribute is null — override to throw an error instead. |
memberOf (DN-valued) |
memberOf |
Multi-valued DN references resolved to Entra ID object IDs via the connector space join rule. Nested group membership is resolved recursively by the sync engine. |
proxyAddresses |
proxyAddresses |
SMTP/X400/X500 list; primary address prefixed SMTP: (uppercase). Conflicts with existing cloud-only users resolved by highest precedence rule. |
msDS-ExternalDirectoryObjectId |
immutableId |
Set only when federating with AD FS; used to link the on-prem user to an existing Entra ID user. Leave null for PHS deployments. |
object_sync_error. The resolution is to either rename the cloud account's UPN (e.g. [email protected] → [email protected]) or to set an immutableId mapping before cutover.objectGUID cannot receive a stable anchor. The sync engine falls back to a hash of objectSID, but this is not guaranteed across domain moves — enforce a rule that all synced objects must carry objectGUID.cycle-detected errors and may silently drop memberships. Use the Synchronisation Rules Editor to enable recursive group expansion or manually flatten circular nesting before scoping.@corp.contoso.com) that is not registered in Entra ID will receive the tenant's default suffix, breaking sign-in. Every UPN suffix must be added as a custom domain in Entra ID before the first sync.groupType set to Universal Distribution but lack a mail attribute are synced as Security groups in Entra ID, silently losing the ability to send mail. Configure Exchange Hybrid or set a mail alias via a sync rule transform before cutover.Delete flow rule, then verify the connector space before committing.provisioningapi[.].blob.core.windows.net ), the sync stalls silently. Validate firewall rules during discovery.Compare-Object $cloudList $onPremList -Property userPrincipalName,memberOf) and remediate any discrepancies before exiting Staging Mode. Once Staging Mode is disabled, perform a delta sync and immediately run the Entra ID provisioning logs report, scanning for entrySyncError and objectSyncError events; triage each error before the next delta cycle runs. To guarantee reversibility, retain the Staging Mode export as a snapshot and do not decommission the on-premises AD — the on-prem directory remains the system of record. If a rollback is required, run Set-MsolDirSyncEnabled -EnableDirSync $false (via MSOnline module) to disable directory synchronisation, clean the delta in Entra ID, and re-enable sync after scope corrections are applied. Finally, validate sign-in for a sample of five users per OU by confirming their Entra ID UPN resolves and that group membership is reflected in an Azure AD‑joined application access check before closing the cutover window. Reading the reference is free. Delivering it under liability — with the safeguards that keep production running through the cutover — is what we do.