ServiceNow LDAP integration enables automated synchronization of user accounts and group memberships from Active Directory or other LDAP-compliant directory services into ServiceNow's user management system. This integration solves the critical business problem of maintaining consistent identity information across systems, eliminating manual user provisioning tasks, and ensuring proper access controls are maintained as organizational changes occur. IT administrators and ServiceNow platform owners rely on this integration to maintain accurate user data and group assignments that drive role-based access control throughout the platform. The integration supports unidirectional data flow from LDAP directories to ServiceNow, triggered by scheduled imports that can run at configurable intervals to detect changes in user attributes, group memberships, and organizational unit structures. The primary configuration occurs within the User Administration module using LDAP Server records and Data Sources, with optional MID Server components for secure connectivity to internal directory services.
Prerequisites
- •ServiceNow Utah or later with User Administration plugin active
- •MID Server installed and validated if LDAP server is behind corporate firewall
- •LDAP service account with read permissions to required OUs and user attributes
- •SSL certificates installed on MID Server if using LDAPS protocol
- •Network connectivity from ServiceNow instance or MID Server to LDAP server on ports 389 (LDAP) or 636 (LDAPS)
- •Admin or user_admin role in ServiceNow to configure LDAP settings
- •Knowledge of Active Directory schema and organizational unit structure
Architecture Overview
ServiceNow LDAP integration uses native LDAP Data Sources and LDAP Server records rather than Integration Hub spokes, providing direct protocol-level communication with directory services. Authentication is established using a service account with credentials stored in LDAP Server configuration records within ServiceNow, supporting both simple bind authentication and anonymous binding depending on directory server configuration. Data flows unidirectionally from LDAP to ServiceNow through scheduled import operations that query specified organizational units and update user records based on configurable field mappings and transformation scripts. A MID Server is required when the LDAP directory resides behind corporate firewalls or requires SSL certificate validation, as it provides secure tunneling and local certificate management capabilities that the cloud instance cannot handle directly. The integration respects LDAP server query limits and implements paging mechanisms to handle large result sets, though specific rate limiting depends on the target directory server configuration rather than ServiceNow-imposed quotas.
Sourdough: ServiceNow Monitoring and Analytics
A Chrome extension for ServiceNow Admins and Developers with essential tools, analytics, graphs and monitoring features.
Free to install. Pro $5/month after a 14-day no-card trial.
Pro requires the ServiceNow admin role. Upgrade inside the extension.
Implementation Steps
Configure LDAP Server Connection Record
Navigate to User Administration > LDAP > LDAP Servers and create a new LDAP Server record. Enter the server hostname or IP address, specify port 389 for LDAP or 636 for LDAPS, and configure the Base DN to point to your root search context like 'DC=company,DC=com'. Set the authentication method to 'Simple' and enter your service account credentials in the User DN field using full distinguished name format like 'CN=svcaccount,OU=Service Accounts,DC=company,DC=com'. Enable SSL if using port 636 and select the appropriate MID Server if the LDAP server requires tunneled connectivity. Click the 'Test Connection' button to verify basic connectivity before proceeding to data source configuration.
Create LDAP Data Source for User Import
Navigate to System Import Sets > Data Sources and create a new Data Source with Type set to 'LDAP'. Reference the LDAP Server created in step 1 and configure the Search Base to target specific organizational units like 'OU=Users,OU=Corporate,DC=company,DC=com'. Set the Search Filter to '(&(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))' to import enabled user accounts only, avoiding disabled accounts that could create security issues. Configure the Return Fields list to include essential attributes like 'sAMAccountName,mail,displayName,department,manager,memberOf' that will map to ServiceNow user fields. Set the Search Scope to 'Subtree' to include all nested organizational units within your specified search base, ensuring comprehensive user discovery across complex directory structures.
Configure Field Mapping and Transform Map
From your LDAP Data Source record, click 'Create Transform Map' to establish field mappings between LDAP attributes and ServiceNow user table fields. Map critical fields like sAMAccountName to user_name, mail to email, displayName to name, and department to department ensuring these core identity attributes populate correctly. Configure the transform map to use 'user_id' as the coalesce field, allowing updates to existing users rather than creating duplicates on subsequent imports. Create field mapping entries for each LDAP attribute, using transform scripts where necessary to handle complex data transformations like parsing manager distinguished names into manager references or converting department codes to readable names. Enable 'Update existing records' and 'Create new records' options based on your organizational requirements for user lifecycle management.
// Transform script for manager field mapping
(function transformEntry(source) {
var managerDN = source.u_manager;
if (managerDN) {
// Extract CN from DN: CN=John Doe,OU=Users,DC=company,DC=com
var cnMatch = managerDN.match(/CN=([^,]+)/);
if (cnMatch && cnMatch[1]) {
var gr = new GlideRecord('sys_user');
gr.addQuery('name', cnMatch[1]);
gr.query();
if (gr.next()) {
return gr.getUniqueValue();
}
}
}
return '';
})(source);Set up Group Membership Synchronization
Create a separate LDAP Data Source specifically for group membership synchronization by navigating to System Import Sets > Data Sources and selecting Type 'LDAP'. Configure this data source to search for group objects using a search filter like '(objectClass=group)' and include member attributes that list distinguished names of group members. Set up a corresponding Transform Map targeting the 'sys_user_grmember' table to establish group membership relationships, mapping group common names to ServiceNow groups and member DNs to user records. Configure field mappings to extract user identifiers from member DNs and resolve them to existing ServiceNow user records, ensuring proper group assignments are maintained. Use transform scripts to handle nested group memberships and filter out service accounts or system groups that should not be synchronized to ServiceNow roles and groups.
// Transform script for group membership processing
(function transformEntry(source) {
var groupName = source.u_cn; // Group common name
var members = source.u_member; // Multi-value member DNs
if (members && groupName) {
var memberArray = members.split(';'); // Handle multi-value attribute
for (var i = 0; i < memberArray.length; i++) {
var memberDN = memberArray[i].trim();
var cnMatch = memberDN.match(/CN=([^,]+)/);
if (cnMatch && cnMatch[1]) {
// Create group membership record
var grMember = new GlideRecord('sys_user_grmember');
grMember.initialize();
// Additional logic to resolve user and group references
}
}
}
})(source);Configure MID Server SSL Certificate Trust
If using LDAPS protocol, navigate to MID Server > Certificates on your MID Server host and import the LDAP server's SSL certificate chain into the MID Server's Java keystore. Use the certificate management utilities provided with the MID Server installation to import root CA certificates and any intermediate certificates required for SSL validation. Configure the MID Server properties to include 'mid.ssl.use_ssl_trust_store=true' and verify the keystore path is correctly specified in the config.xml file. Test SSL connectivity using MID Server diagnostic tools before attempting LDAP synchronization, ensuring certificate validation passes without errors. Update the LDAP Server record in ServiceNow to enable SSL and specify the configured MID Server, then retest the connection to confirm encrypted connectivity is working properly.
Implement Organizational Unit Filtering
Configure OU-specific filtering by modifying your LDAP Data Source search base and filter criteria to target specific organizational units while excluding others like service accounts or test user containers. Create multiple LDAP Data Sources if different OUs require different processing rules or field mappings, allowing granular control over which users are imported from each organizational division. Set up exclusion filters using LDAP filter syntax like '(&(objectClass=user)(!(cn=*svc*))(!(ou=*test*)))' to prevent service accounts and test users from being synchronized to your production ServiceNow instance. Configure search scope settings appropriately, using 'One Level' for single OU imports or 'Subtree' for hierarchical OU structures, depending on your organizational requirements. Document your filtering strategy to ensure other administrators understand which users are included or excluded from synchronization processes.
Schedule Automated LDAP Import Jobs
Navigate to System Import Sets > Scheduled Data Imports and create scheduled jobs for each LDAP Data Source configured in previous steps. Set import frequency based on your organization's requirements, typically daily for user attributes and weekly for group memberships, balancing data freshness with system performance considerations. Configure the scheduled import to run during maintenance windows or low-usage periods to minimize impact on user experience and system resources. Enable email notifications for import failures and configure recipient lists to include LDAP administrators and ServiceNow platform owners who can respond to synchronization issues. Set up import monitoring by enabling detailed logging and configuring retention policies for import set records, ensuring you can troubleshoot historical import issues while managing storage consumption.
// Business Rule to monitor LDAP import completion
(function executeRule(current, previous /*null when async*/) {
if (current.state == 'processed' && current.source.name.indexOf('LDAP') > -1) {
var importSets = new GlideRecord('sys_import_set_row');
importSets.addQuery('import_set', current.sys_id);
importSets.addQuery('import_row_state', 'error');
importSets.query();
if (importSets.getRowCount() > 0) {
// Send notification about import errors
var notification = new GlideEmailOutbound();
notification.setSubject('LDAP Import Errors Detected');
notification.setBody('Import set ' + current.number + ' completed with ' + importSets.getRowCount() + ' errors.');
notification.addAddress('ldap-admins@company.com');
notification.send();
}
}
})(current, previous);Test and Validate LDAP Integration
Execute a manual test import by navigating to your LDAP Data Source and clicking 'Test Load 20 Records' to verify field mappings and transformation logic work correctly with sample data. Review the generated import set records to confirm LDAP attributes are properly extracted and mapped to appropriate ServiceNow fields, checking for data truncation or formatting issues. Run a full import in a sub-production instance first, comparing imported user data against the source LDAP directory to validate accuracy and completeness of the synchronization process. Verify group membership synchronization by checking that users appear in appropriate ServiceNow groups and roles after import completion, testing both addition and removal of group memberships. Monitor system logs during test imports for any errors or warnings that could indicate configuration issues, and validate that disabled LDAP accounts are properly handled according to your organization's deprovisioning requirements.
// Script to validate LDAP import results
var gr = new GlideRecord('sys_user');
gr.addQuery('source', 'ldap');
gr.addQuery('sys_created_on', 'ON', 'Today');
gr.query();
gs.info('LDAP users imported today: ' + gr.getRowCount());
// Check for users with missing email addresses
var invalidUsers = new GlideRecord('sys_user');
invalidUsers.addQuery('source', 'ldap');
invalidUsers.addQuery('email', '');
invalidUsers.query();
if (invalidUsers.getRowCount() > 0) {
gs.warn('Found ' + invalidUsers.getRowCount() + ' LDAP users without email addresses');
}Common Use Cases
Automated Daily User Provisioning
Organizations use scheduled LDAP imports to automatically provision new employee accounts in ServiceNow within 24 hours of Active Directory creation. The integration detects new user objects in specified organizational units and creates corresponding ServiceNow user records with proper role assignments based on department and group memberships. This eliminates manual account creation tickets and ensures consistent user data across systems while maintaining proper access controls from day one of employment.
Department Transfer and Role Updates
When employees change departments or roles, LDAP synchronization automatically updates ServiceNow user records to reflect new organizational structures, manager relationships, and group memberships. The integration processes modified user attributes during scheduled imports and triggers workflow processes that adjust ServiceNow role assignments, group memberships, and access permissions based on new departmental affiliations. This ensures that users maintain appropriate access levels as they move within the organization without manual intervention from IT administrators.
Automated User Deprovisioning
LDAP integration handles employee terminations by detecting disabled or deleted accounts in Active Directory and automatically deactivating corresponding ServiceNow user records. The synchronization process identifies accounts with userAccountControl flags indicating disabled status and sets the ServiceNow user record to inactive, preventing login while preserving historical data and assignment records. This automated deprovisioning reduces security risks by ensuring terminated employees lose system access promptly without requiring manual account management.
Group-Based Role Assignment
ServiceNow administrators leverage LDAP group membership synchronization to automatically assign platform roles based on Active Directory security group memberships. Users added to specific AD groups like 'ServiceNow-ITILUsers' automatically receive corresponding ServiceNow roles during the next import cycle, eliminating manual role assignment processes. This approach ensures role assignments remain consistent with organizational policies defined in Active Directory while reducing administrative overhead for user access management.
Multi-Domain Organization Synchronization
Large enterprises with multiple Active Directory domains configure separate LDAP data sources for each domain, enabling comprehensive user synchronization across diverse organizational structures. Each domain-specific data source includes tailored OU filtering and field mapping to handle different schema extensions and organizational policies while consolidating all users into a unified ServiceNow user base. This supports complex merger and acquisition scenarios where multiple directory services must coexist while providing seamless user experience across the ServiceNow platform.
Troubleshooting
LDAP connection test fails with 'Cannot connect to LDAP server' error
First verify network connectivity by testing port access from the MID Server or ServiceNow instance to the LDAP server using telnet or network utilities. Check that the LDAP server hostname resolves correctly and that firewall rules permit traffic on the configured port (389 for LDAP, 636 for LDAPS). If using a MID Server, verify the MID Server is up and validated, and check MID Server logs for SSL certificate or authentication errors that might prevent connection establishment.
Users imported but missing group memberships
Review the LDAP search filter and return fields configuration to ensure 'memberOf' attribute is included in the user data source query results. Check that your service account has sufficient permissions to read group membership information from Active Directory, as some organizations restrict this access. Verify the group membership transform map is correctly parsing memberOf attributes and resolving group distinguished names to existing ServiceNow group records, using transform map test functionality to debug field mapping issues.
Import set processing fails with 'Field value too long' errors
Examine the import set error details to identify which LDAP attributes exceed ServiceNow field length limits, commonly occurring with long distinguished names or multi-value attributes. Modify transform scripts to truncate or parse lengthy values appropriately, such as extracting common names from distinguished names rather than storing full DN strings. Consider extending ServiceNow field lengths if the full LDAP data is required, or implement data normalization logic to handle oversized attribute values gracefully during import processing.
Scheduled imports complete but no records are updated
Verify the LDAP search base and filter criteria are returning results by testing manual data loads with limited record counts to confirm query functionality. Check that the coalesce field configuration in the transform map matches existing user records, ensuring updates can find matching records rather than attempting to create duplicates. Review import set logs for transformation errors or field mapping issues that might prevent successful record processing, and confirm that 'Update existing records' option is enabled in the transform map configuration.
SSL handshake failures when using LDAPS protocol
Import the complete certificate chain for your LDAP server into the MID Server's Java keystore, including root CA and intermediate certificates required for proper SSL validation. Use Java keytool commands or MID Server certificate management utilities to verify certificate installation and validate trust relationships. Check that certificate common names or subject alternative names match the hostname used in LDAP Server configuration, and ensure certificates have not expired or been revoked by checking certificate validity dates and CRL status.
Import performance degrades with large user datasets
Implement OU-based filtering to reduce the scope of LDAP queries, targeting specific organizational units rather than searching the entire directory structure during each import cycle. Configure LDAP data source paging settings to handle large result sets more efficiently, and consider splitting large imports into multiple smaller data sources that target different user populations. Schedule imports during off-peak hours and adjust import frequency based on actual change rates in your directory, as daily imports may be unnecessary if user data changes infrequently in your organization.
Pro Tips
- →Implement a staging approach by creating duplicate LDAP data sources that target a sub-production ServiceNow instance first, allowing you to validate import results and field mappings before applying changes to production user data. This prevents widespread user account issues and allows testing of complex transformation logic against real LDAP data without impacting live users.
- →Create custom business rules that trigger on user record updates to automatically assign roles and groups based on imported LDAP attributes like department or job title, extending basic group membership sync with sophisticated role assignment logic. Use these rules to implement organizational policies that go beyond simple group mapping, such as automatic approval delegation or notification subscriptions based on user hierarchy.
- →Configure import set cleanup jobs with appropriate retention policies to prevent system tables from growing indefinitely while maintaining sufficient historical data for troubleshooting import issues. Archive successful import sets after 30-90 days but retain failed import sets longer to support root cause analysis of recurring synchronization problems.
- →Leverage ServiceNow's Data Source Extensions to implement custom LDAP attribute processing for organization-specific directory schema extensions or complex multi-value attribute handling. This allows you to process custom AD attributes or implement sophisticated data transformation logic that exceeds the capabilities of standard field mapping and transform scripts.
- →Set up comprehensive monitoring using ServiceNow Event Management or external monitoring tools to track import success rates, processing times, and error patterns across all LDAP data sources. Create alerts for import failures, unusual processing times, or significant changes in imported record counts that might indicate directory service issues or configuration problems.
- →Implement delta synchronization strategies by using LDAP timestamp attributes like 'whenChanged' or 'modifyTimeStamp' in search filters to import only recently modified user accounts rather than processing the entire user base during each import cycle. This dramatically improves performance for large organizations while ensuring changes are captured promptly.
Known Limitations
- —ServiceNow LDAP integration supports only unidirectional data flow from LDAP to ServiceNow, requiring separate provisioning solutions if you need to push ServiceNow changes back to Active Directory. The integration cannot create, modify, or delete LDAP objects, limiting its use to read-only synchronization scenarios that may not meet organizations requiring bidirectional identity management.
- —Complex nested group relationships and dynamic group memberships in Active Directory may not synchronize correctly due to limitations in LDAP query processing and ServiceNow's group membership model. Organizations with sophisticated AD group policies or dynamic distribution groups may experience incomplete group synchronization requiring manual role assignment processes.
- —LDAP import performance degrades significantly with datasets exceeding 10,000 users per import cycle, potentially causing timeout issues and incomplete synchronization in large enterprise environments. Organizations with massive user bases may need to implement multiple data sources with OU-based filtering to maintain acceptable import performance and reliability.
- —Transform map processing limitations prevent sophisticated data manipulation during import, requiring post-processing business rules or scheduled jobs to implement complex user data normalization or role assignment logic. This can create dependencies between import timing and subsequent processing that complicate troubleshooting and error recovery procedures.
- —MID Server SSL certificate management requires manual intervention for certificate renewals and updates, creating operational overhead and potential service disruptions if certificates expire unexpectedly. Organizations must implement certificate monitoring and renewal processes to maintain secure LDAPS connectivity over time.
Frequently Asked Questions
Can ServiceNow LDAP integration handle multiple Active Directory forests or domains?
Yes, you can configure separate LDAP Server and Data Source records for each Active Directory domain or forest, allowing comprehensive synchronization across complex enterprise environments. Each domain requires its own service account and connection configuration, but all users import into the same ServiceNow user table with proper source tracking. Consider using domain-specific prefixes or suffixes in usernames to avoid conflicts between domains with overlapping account names.
How frequently should LDAP imports be scheduled for optimal performance?
Most organizations find daily imports provide the best balance between data freshness and system performance, though this depends on your change rate and business requirements. User attribute changes typically justify daily synchronization, while group memberships might only require weekly updates if organizational changes are infrequent. Monitor import duration and system impact to determine optimal scheduling, and consider off-peak hours to minimize user experience impact during processing.
What happens to ServiceNow user records when corresponding LDAP accounts are deleted?
ServiceNow LDAP integration does not automatically delete user records when LDAP accounts are removed, as this could cause data integrity issues with historical assignments and records. Instead, configure your import to detect disabled accounts using userAccountControl flags and set ServiceNow users to inactive status, preserving historical data while preventing future login access. Implement separate cleanup processes if your organization requires actual record deletion for terminated employees.
Can LDAP integration sync custom Active Directory schema extensions?
Yes, ServiceNow can import custom AD attributes by including them in the LDAP Data Source return fields list and creating corresponding field mappings in the transform map. You may need to extend the ServiceNow user table with custom fields to store organization-specific attributes, or use existing fields with appropriate data transformation. Test custom attribute synchronization carefully to ensure proper data type handling and field length compatibility.
How do I troubleshoot transform map errors during LDAP imports?
Use the transform map's 'Test with Sample Data' feature to debug field mapping and transformation logic with actual LDAP data before running full imports. Check import set error logs for specific field mapping failures and use debug logging in transform scripts to trace data processing issues. The Import Set table provides detailed error messages for each failed record, helping identify patterns in transformation problems that need script or mapping corrections.
Is MID Server required for all LDAP integrations?
MID Server is required when your LDAP server is behind a corporate firewall, uses SSL certificates that require local validation, or needs specific network routing that the ServiceNow cloud instance cannot access directly. Public-facing LDAP servers with standard configurations may work with direct connectivity, but most enterprise Active Directory implementations require MID Server for security and network access reasons. Always test connectivity requirements before committing to a deployment architecture.
Can LDAP integration be used with cloud-based directory services like Azure AD?
While technically possible using Azure AD Domain Services LDAP interface, Microsoft recommends using modern protocols like SCIM or Graph API for Azure AD integration with SaaS platforms. ServiceNow provides dedicated Azure AD integration capabilities through the Microsoft Azure Active Directory spoke in Integration Hub, which offers better performance and feature support than LDAP-based synchronization. Consider the Azure AD spoke for cloud directory environments rather than forcing LDAP connectivity.
Test Your Knowledge
Quick 3-question quiz — see how your ServiceNow skills stack up.
A list view on a table with millions of records is slow. Best fix?
Select an answer to continue