Synchronizing users and groups from OpenLDAP or Active Directory into Authentik via the LDAP source: server URI configuration, bind DN, base DN and filters, attribute mapping, sync schedules, AD group usage, and the fundamental difference from the LDAP outpost.

In episode 16, Authentik trusted cloud identity providers through OAuth sources. Episode 17 covers a source closer to the enterprise world: the LDAP source, which imports users and groups from an existing directory — OpenLDAP, FreeIPA, or Active Directory (AD) — into Authentik.
Why synchronize? Organizations that already have AD don't want to move 500 users into the Authentik database manually. With an LDAP source, Authentik becomes an LDAP client: it periodically reads users and groups from the directory, creates internal users, and uses that data for login and policies. The directory remains the source of truth.
Analogy: you don't photocopy the entire employee archive into a new book. You build an automatic bridge that copies data from the old archive into the new system, then updates the copy on a schedule.
In the Admin interface, open Directory → Federation and Social login → Create → LDAP Source. Core fields:
| Field | OpenLDAP example | Active Directory example |
|---|---|---|
| Server URI | ldaps://ldap.example.com | ldaps://dc1.ad.example.com |
| Bind CN | cn=admin,dc=example,dc=com | CN=svc-authentik,CN=Users,DC=ad,DC=example,DC=com |
| Base DN | dc=example,dc=com | DC=ad,DC=example,DC=com |
| User object filter | (objectClass=person) | (objectClass=user) |
| Group object filter | (objectClass=groupOfNames) | (objectClass=group) |
ldaps:// (port 636) or ldap:// with StartTLS for credential data. Several servers can be separated by commas for redundancy.Important
Make ldaps:// the standard. Passwords — even though Authentik never reads them (what's synchronized are hashes) — are still sensitive data that must not travel over an open channel. For AD, make sure LDAPS is active on port 636 before configuring the source.
Users and groups from LDAP are mapped to Authentik properties via property mappings. Common built-in mappings:
uid attribute (OpenLDAP) or sAMAccountName (AD).mail attribute.displayName or cn attribute.goauthentik.io/sources/ldap.Built-in mappings are enough for most cases. For special needs, create a custom mapping. The available context is ldap (the raw attribute dictionary) and dn (the object's distinguished name). Example combining two attributes:
return f"{list_flatten(ldap.get('givenName'))} {list_flatten(ldap.get('sn'))}"Note the use of list_flatten — many LDAP attributes are lists, and this helper takes the single element. Expressions returning None are skipped.
Synchronization runs automatically through Authentik's task system, by default every two hours (and once when the source is saved). Options you can set:
memberOf) instead of from the group. Required to handle nested groups in AD and FreeIPA.Manual sync can be triggered from the Sync tab on the source, or via the worker command:
docker compose run --rm worker ldap_sync ldap-adAnd to check connectivity to the LDAP server:
docker compose run --rm worker ldap_check_connection ldap-adRun these commands when troubleshooting: ldap_check_connection separates connection problems from synchronization problems, and ldap_sync in the foreground shows errors directly in the console.
After synchronization, AD groups appear as Authentik groups. Group membership can be used directly in policies (episode 6): grant an application access only to the DC-administrators group, enforce mandatory MFA for the staff group, and so on.
Two things to watch for with AD:
lookup_groups_from_user and set the group membership field to memberOf so indirect membership is correctly resolved.objectSid as the stable identifier. Make sure this field is consistent; a changing identifier makes Authentik treat the user as a new entity.When the import doesn't behave as expected, split the problem into two layers: connection and data.
ldap_check_connection (example above). Common causes: untrusted server certificate, LDAPS port blocked by a firewall, or a bind account without read rights.ldapsearch against the same base DN; if that query doesn't return the expected objects, the source configuration won't either.objectSid). An unstable identifier makes Authentik treat the same user as a new entity on every sync.The worker task log is the primary diagnosis source — sync tasks write the details of every created, changed, or deleted object, complete with execution timestamps.
The term "LDAP" appears in Authentik in two places with opposite roles. Don't mix them up:
| Aspect | LDAP Source | LDAP Outpost (provider) |
|---|---|---|
| Data direction | Directory → Authentik | Authentik → LDAP application |
| Authentik's role | LDAP client (reads) | LDAP server (serves) |
| Purpose | Import existing users/groups | Let legacy applications log in with LDAP |
| Example | Company's existing OpenLDAP/AD | Old apps that only understand the LDAP protocol |
An LDAP source copies a directory into Authentik (one direction). An LDAP outpost does the opposite: Authentik presents its internal users as an LDAP server so legacy applications can bind. Episode 18 covers the LDAP outpost thoroughly.
Tip
If you already have a well-managed directory (AD or OpenLDAP), the LDAP source is the right choice — one source of truth, with Authentik as its consumer. If what you have is a legacy application that can only speak LDAP, you need an LDAP outpost. Both can be used together: the source for import, the outpost for service.
This episode configured the LDAP source: understanding the server URI, bind DN, base DN and filter fields for both OpenLDAP and Active Directory, mapping attributes via property mappings with the ldap and dn context, setting the schedule and sync options, using AD groups for policies, and distinguishing the LDAP source from the LDAP outpost.
The key: the directory remains the source of truth, and Authentik copies it periodically — not the other way around. In episode 18, we reverse the direction with the LDAP outpost provider: Authentik acting as an LDAP server for legacy applications. See you there!