
Many third-party products authenticate users against Active Directory (AD) using the Lightweight Directory Access Protocol (LDAP) [RFC 4511]. Firewalls, VPN gateways, storage arrays, virtualization platforms, and countless line-of-business applications need a reliable way to query the directory and validate user credentials. Too often, these services are configured to use clear-text LDAP to a single domain controller, a design that exposes credentials on the network and fails when that domain controller goes offline. A better approach is to provide a highly available LDAP over Transport Layer Security (TLS) service, commonly called LDAPS, behind a load balancer, with certificates that renew automatically and never require manual intervention. Michael Waterman covers the architecture well in Building High Available LDAPS Architectures, and I build on that foundation here with automated certificate binding and renewal.
LDAP Security
Microsoft has been tightening LDAP security defaults for some time, and Windows Server 2025 continues that trend. Administrators deploying new domain controllers should be aware of the following changes.
- LDAP Signing: Windows Server 2025 requires LDAP signing by default for new AD deployments. Domain controllers upgraded in place keep any existing signing policy.
- Channel Binding: Windows Server 2025 sets LDAP channel binding to “When supported” by default. Domain controllers accept channel binding tokens when clients provide them but do not yet require them.
- Channel Binding Auditing: Auditing for LDAP channel binding is enabled by default, allowing administrators to identify clients that do not support it.
Importantly, LDAP signing applies only to Simple Authentication and Security Layer (SASL) [RFC 4422] binds. Most third-party services use simple binds, which send the username and password in clear text when using LDAP on TCP port 389. Signing does nothing to protect these credentials, and Windows Server 2025 domain controllers that require signing reject simple binds over unencrypted connections entirely. Regardless of the domain controller’s signing configuration, clear-text LDAP is never recommended. LDAPS encrypts the entire session, including the bind, and should be used by any service that authenticates to AD.
LDAPS Clients
LDAPS clients are typically network appliances, non-Windows servers, and applications that need to authenticate users against AD but cannot take advantage of native AD features. These clients usually share the following traits.
- Not Domain-Joined: The client is not a member of the domain and cannot use the domain controller locator to find a nearby, healthy domain controller.
- Simple Bind: The client authenticates using a simple bind with a username and password instead of Kerberos.
- Single Server: The client is configured with a single hostname or IP address for the directory server, with no awareness of AD sites or domain controller health. Some devices allow a secondary server, but failover behavior varies widely.
- Separate Trust Store: The client does not automatically trust the enterprise public key infrastructure (PKI). Administrators must import the root and issuing Certification Authority (CA) certificates into the device’s trust store before LDAPS will work.
Examples beyond those mentioned previously include network access control platforms such as Cisco ISE and Aruba ClearPass, Linux hosts using the System Security Services Daemon (SSSD), and multifunction printers.
LDAPS Overview
LDAPS is simply LDAP protected by TLS, with the client connecting to the domain controller on TCP port 636. For the TLS handshake to succeed, the domain controller must present a certificate that meets the following requirements.
- Server Authentication: The certificate must include the Server Authentication Enhanced Key Usage (EKU) (1.3.6.1.5.5.7.3.1).
- Subject Name: The certificate must include the name the client uses to connect to the service in the Subject Alternative Name (SAN).
- Private Key: The domain controller must have the certificate’s associated private key.
- Trust: The certificate must chain to a root CA that the client trusts.
Certificate Selection
Domain controllers look for an LDAPS certificate in two places. A valid certificate in the NTDS service’s personal certificate store is always preferred. The local computer’s personal certificate store is used only when the NTDS store does not contain a suitable certificate. When multiple eligible certificates exist in the same store, the domain controller selects the one with the latest expiration date, which can lead to unexpected results when domain controllers have accumulated several Server Authentication certificates over time. Also, the certificate’s subject must match the domain controller’s FQDN for the certificate to be considered at all. Marc-AndrĂ© Moreau explains the selection process in detail in his excellent article, Active Directory LDAPS certificate selection deep dive.
Avoid Individual Domain Controllers
Configuring an LDAPS client to connect directly to a specific domain controller is a common practice, but it is problematic for many reasons. Domain controllers are routinely added, retired, and rebuilt, and each change requires updating every device that references the old server. In addition, a client configured with a single domain controller has a single point of failure. If that domain controller is offline for maintenance or fails unexpectedly, authentication for that service fails with it.
Domain Name Workaround
A simple workaround is to configure LDAPS clients to use the AD domain name (for example, corp.example.net) instead of an individual domain controller name (for example, dc1.corp.example.net). The AD domain name resolves to the IP addresses of all domain controllers in the domain, and no new certificate is required because the default Kerberos Authentication certificate template includes the domain name in the SAN. However, this approach relies on DNS alone. DNS has no awareness of domain controller health; clients may cache records for a failed server, and the domain name resolves to domain controllers in every site, including remote sites across slow WAN links. It works in a pinch, but it is not a substitute for a load balancer in enterprise deployments.
Load Balanced LDAPS
The recommended approach for enterprise deployments is to place domain controllers behind a load balancer and publish a dedicated LDAPS service name (for example, ldaps.corp.example.net) that resolves to the load balancer’s virtual IP address. Load balancer configuration is out of scope here, as it varies by vendor and operator preference. However, the load balancer must meet the following requirements.
- TCP Port 636: The load balancer must distribute connections on TCP port 636.
- TLS Passthrough: The load balancer must operate in TCP (layer 4) mode and must not terminate TLS. Terminating TLS on the load balancer prevents clients from validating the domain controller’s certificate and breaks LDAP channel binding.
- Health Checks: I strongly recommend configuring health checks that validate the LDAPS service itself, not simply that TCP port 636 is open. Most commercial and open source load balancers support this configuration.
Some clients also require access to the global catalog (GC) over LDAPS on TCP port 3269. This is common in multi-domain forests, where a single LDAP server definition must locate and authenticate users from any domain, and with applications configured to use the GC port by default. In these scenarios, publish TCP port 3269 on the load balancer using the same TLS passthrough configuration and health checks, and ensure every domain controller in the pool is a GC server. The LDAPS certificate serves both ports, so no additional certificate configuration is required. Keep in mind that the GC holds only a partial set of attributes for objects in other domains. In a single-domain forest, TCP port 636 provides access to all directory data, and TCP port 3269 is not required.
Also, the load balanced LDAPS service is designed primarily for non-Windows systems using simple binds over LDAPS. Domain-joined Windows clients should continue to use the DC locator and Kerberos natively. Clients that attempt Kerberos authentication (SASL with the Generic Security Service Application Program Interface (GSSAPI)) to the service name will not work as expected because the required Service Principal Name (SPN) (ldap/ldaps.corp.example.net) can be registered on only one domain controller computer account. These clients will fall back to NTLM or fail entirely.
Note: Read-Only Domain Controllers (RODCs) should not be included in the load balanced pool. RODCs hold a read-only copy of the directory and return referrals for write operations, which can cause unexpected behavior for services that perform password changes or other directory updates.
Certificate Requirements
Every domain controller in the load balanced pool must present a certificate that includes the LDAPS service name. To ensure consistent name coverage, the certificate’s subject should be the domain controller’s fully qualified domain name (FQDN), and the SAN should include the following names.
- Domain controller FQDN (for example, dc1.corp.example.net)
- Domain controller single-label hostname (for example, dc1)
- Domain FQDN (for example, corp.example.net)
- LDAPS service name (for example, ldaps.corp.example.net)
- LDAPS service short name (for example, ldaps)
Not all of these names are strictly required for the load balanced service. However, the certificate bound to the NTDS store is used for every LDAPS connection to the domain controller, regardless of the name the client uses. Including all of these names ensures that clients connecting to the domain controller directly, to the domain name, or to the load balanced service name continue to work.
Note: The domain controller’s FQDN is used as the subject, rather than the LDAPS service name, so that each domain controller’s certificate is uniquely identifiable when approving requests, reviewing issued certificates, and troubleshooting connections through the load balancer. Modern TLS clients validate the server name against the SAN, not the subject, so the LDAPS service name only needs to appear in the SAN. Legacy clients that validate only the subject’s common name are rare but should be tested before deployment.
Create the Certificate Template
To create the certificate template, open the Certificate Templates management console (certtmpl.msc), right-click the Web Server template, choose Duplicate Template, and configure the following settings.
Compatibility Tab
On the Compatibility tab, select Windows Server 2016 for the Certification Authority and Windows 10/Windows Server 2016 for the Certificate recipient.
Certificate Template Compatibility Settings
Note: If any issuing CAs or domain controllers in the environment run an operating system older than Windows Server 2016, set the Compatibility Settings to match the oldest version in use. Selecting a version newer than the oldest CA or domain controller may prevent those servers from issuing or enrolling for the certificate.
General Tab
On the General tab, enter a descriptive name in the Template display name field (for example, LDAPS Service) and define the validity and renewal periods. The validity period should be no more than one year, and I recommend shorter lifetimes where practical. See The Case for Short-Lived Certificates in Enterprise Environments for more details.
Certificate Template General Settings
Note: The example shown here uses a short 14-day validity period with a 2-day renewal period. I strongly recommend testing the deployment with short-lived certificates (1 to 2 weeks) first. Short lifetimes allow administrators to observe several renewal cycles in a short period and confirm the automation is working as expected. Be sure the renewal period is shorter than the validity period. Once renewal automation is validated, update the template to use a longer validity period. Existing certificates adopt the new lifetime when they next renew.
Request Handling Tab
On the Request Handling tab, ensure that Allow private key to be exported is not selected.
Certificate Template Request Handling Settings
Cryptography Tab
On the Cryptography tab, select Key Storage Provider from the Provider Category drop-down list, RSA from the Algorithm name drop-down list, enter 2048 for the Minimum key size, and select SHA256 from the Request hash drop-down list. I recommend RSA 2048 because it provides the broadest compatibility with LDAPS clients. Elliptic Curve (EC) certificates are arguably a better choice from a security and performance perspective, but some services that require LDAPS may not support them.
Certificate Template Cryptography Settings
Subject Name Tab
On the Subject Name tab, select Supply in the request and check the box next to Use subject information from existing certificates for autoenrollment renewal requests. This allows the administrator to specify the subject and SAN when initially requesting the certificate, while ensuring the same names are included automatically when the certificate is renewed.
Certificate Template Subject Name Settings
Issuance Requirements Tab
On the Issuance Requirements tab, check the box next to CA certificate manager approval. Allowing the requester to supply the subject name means a certificate could be requested for any name, so requiring approval ensures that an administrator reviews each initial request before the certificate is issued. Next, select Valid existing certificate under Require the following for reenrollment. With this setting, renewal requests signed with the existing valid certificate are issued automatically without approval, which is essential for unattended renewal.
Certificate Template Issuance Requirements Settings
Extensions Tab
On the Extensions tab, confirm that Application Policies includes Server Authentication only. The Web Server template includes only Server Authentication by default, so no changes should be required.
Certificate Template Extensions Settings
Security Tab
On the Security tab, add the Domain Controllers group and grant Read, Enroll, and Autoenroll permissions. Do not grant permissions to the Read-Only Domain Controllers group.
Certificate Template Security Settings
Note: Only the Domain Controllers group should have Enroll permissions on this template. Do not grant Enroll or Autoenroll permissions to any other users or groups.
Publish Template
Once complete, publish the certificate template on the issuing CA. This can be done using the Certification Authority management console (certsrv.msc) or by running the following PowerShell command on the issuing CA.
Add-CATemplate -Name 'LDAPSService' -Force
Note: The Add-CATemplate cmdlet uses the template name, not the template display name. The template name is the display name without spaces by default.
Autoenrollment
Certificate autoenrollment must be enabled on domain controllers to renew LDAPS certificates automatically. I prefer to enable autoenrollment in a Group Policy Object (GPO) linked at the domain level, but at a minimum, the GPO must apply to the Domain Controllers organizational unit (OU). In the GPO, navigate to Computer Configuration > Policies > Windows Settings > Security Settings > Public Key Policies, open Certificate Services Client – Auto-Enrollment, and configure the following settings.
- Configuration Model: Enabled
- Renew expired certificates, update pending certificates, and remove revoked certificates: Checked
- Update certificates that use certificate templates: Checked
Certificate Services Client Auto-Enrollment Settings
Note: Because the template requires the subject to be supplied in the request, autoenrollment will not enroll for the initial certificate. Autoenrollment only renews the certificate once it has been issued.
Certificate Enrollment
The initial certificate must be requested on each domain controller. Run the following PowerShell commands in an elevated PowerShell window on the domain controller. The domain controller’s hostname and domain name are determined automatically, so only the template name and LDAPS service name need to be updated to match your environment.
$ServiceFqdn = 'ldaps.corp.example.net'$ServiceName = $ServiceFqdn.Split('.')[0]$Domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain.ToLower()$Hostname = $env:COMPUTERNAME.ToLower()$Fqdn = "$Hostname.$Domain"Get-Certificate -Template 'LDAPSService' -SubjectName "CN=$Fqdn" -DnsName $Fqdn, $Hostname, $Domain, $ServiceFqdn, $ServiceName -CertStoreLocation 'Cert:\LocalMachine\My'
Note: The LDAPS service name does not have to be in the same DNS namespace as the AD domain. For example, ldaps.example.net is perfectly acceptable for the corp.example.net domain.
Because the template requires CA certificate manager approval, the request status will be Pending.
Certificate Request Pending Approval
Next, an administrator must approve the request. Open the Certification Authority management console (certsrv.msc) on the issuing CA and expand Pending Requests. Before issuing the certificate, inspect the request to ensure it is legitimate, confirming that the requester, subject name, and SAN entries match the expected domain controller and LDAPS service names. Once verified, right-click the request and choose All Tasks > Issue.
Issue Pending Certificate Request
Note: If role separation is enforced on the CA, or if the administrator requesting the certificate does not have certificate manager (Issue and Manage Certificates) permissions on the CA, another administrator may need to approve the request.
Once the request is approved, retrieve and install the certificate by running the following PowerShell commands on the domain controller.
$Request = Get-ChildItem -Path 'Cert:\LocalMachine\Request'Get-Certificate -Request $Request
Certificate Request Issued
Note: If the certificate cannot be retrieved in the same PowerShell session (for example, after waiting for approval), or if Get-Certificate returns an error because other requests are pending, use certreq.exe instead. Retrieve the issued certificate using the Request ID shown in the Certification Authority management console, then install it by running the following commands.
certreq.exe -retrieve 8636 .\ldaps.cercertreq.exe -accept .\ldaps.cer
Bind the Certificate
Certificates issued from the new template are installed in the local computer’s personal certificate store. However, the domain controller’s existing certificates are also in that store, and any of them could be selected for LDAPS. To ensure the domain controller always presents the correct certificate, it must be added to the NTDS service certificate store. The Update-DcLdapsCertificate.ps1 PowerShell script, available on GitHub, automates this process. The script performs the following actions.
- Searches the local computer’s personal certificate store for valid certificates issued from the specified template that include the LDAPS service name in the SAN, have an associated private key, include the Server Authentication EKU, and chain to a trusted root. If more than one certificate qualifies, the certificate with the latest expiration date is selected.
- Imports the selected certificate into the NTDS service certificate store and confirms the import was successful.
- Removes any other certificates from the NTDS service certificate store.
- Forces Active Directory Domain Services (AD DS) to reload its certificate immediately, without a restart, then performs a TLS handshake on TCP port 636 to confirm the domain controller is serving the new certificate.
The script requires the ServiceCertStore PowerShell module. Install it by running the following PowerShell command.
Install-Module -Name ServiceCertStore
The script also requires the certificate template’s Object Identifier (OID). Find the OID on the Extensions tab of the template in the Certificate Templates management console (certtmpl.msc) under Certificate Template Information, or by running the following PowerShell command on the issuing CA.
Get-CATemplate
Certificate Template OID
Next, run Update-DcLdapsCertificate.ps1 manually to bind the initial certificate to the NTDS service certificate store.
.\Update-DcLdapsCertificate.ps1 -TemplateOid '1.3.6.1.4.1.311.21.8.8722825.6961687.14830235.11733548.12561660.205.581940.14651236' -LdapsServiceName 'ldaps.corp.example.net'
Update-DcLdapsCertificate.ps1 Output
Confirm that the certificate was added to the NTDS service certificate store by running the following PowerShell command.
Get-ServiceCertificates -ServiceName NTDS
NTDS Service Certificate Store
Automate Renewal
Autoenrollment renews the LDAPS certificate automatically, but it places the renewed certificate in the local computer’s personal certificate store, not the NTDS service certificate store. Left alone, the domain controller continues to serve the old certificate until it expires. The Register-DcLdapsCertificateTask.ps1 PowerShell script, also available on GitHub, closes this gap by creating a scheduled task that runs Update-DcLdapsCertificate.ps1 whenever a new certificate is installed. The scheduled task has the following characteristics.
- The task is triggered by event ID 1006 (certificate installed) or event ID 1001 (certificate replaced) in the Microsoft-Windows-CertificateServicesClient-Lifecycle-System/Operational event log. Only certificates installed in the computer context that include the Server Authentication EKU trigger the task.
- The task runs one minute after the event to ensure autoenrollment has finished installing the certificate and private key.
- The task has no time-based trigger and never runs on a schedule.
- The task runs as SYSTEM with highest privileges.
Run the following PowerShell command on each domain controller in the load balanced pool, specifying the same template OID and LDAPS service name used previously.
.\Register-DcLdapsCertificateTask.ps1 -TemplateOid '1.3.6.1.4.1.311.21.8.8722825.6961687.14830235.11733548.12561660.205.581940.14651236' -LdapsServiceName 'ldaps.corp.example.net'
Register-DcLdapsCertificateTask.ps1 Output
Note: By default, Register-DcLdapsCertificateTask.ps1 expects Update-DcLdapsCertificate.ps1 to be in the same folder. If Update-DcLdapsCertificate.ps1 is stored elsewhere, use the -ScriptPath parameter to specify its location. Be sure to store both scripts in a permanent location on the domain controller, as the scheduled task references the script at that path.
Validation
Once the certificate is bound and the scheduled task is registered, administrators should confirm that the LDAPS service is working as expected. I recommend using my Get-TlsCertificate.ps1 PowerShell script to view the certificate returned during the TLS handshake. Install the script from the PowerShell Gallery by running the following PowerShell command.
Install-Script -Name Get-TlsCertificate
Next, run the following PowerShell command to view the certificate presented by the load balanced LDAPS service.
Get-TlsCertificate -Hostname 'ldaps.corp.example.net' -Port 636
LDAPS Service Certificate
Confirm that the subject, SAN, EKU, and expiration date are correct. Since the load balancer determines which domain controller responds, I also recommend running the command against each domain controller’s FQDN and comparing the thumbprint to the certificate in the NTDS service certificate store on that domain controller.
Get-TlsCertificate -Hostname 'dc1.corp.example.net', 'dc2.corp.example.net' -Port 636
Domain Controller LDAPS Certificates
Finally, test LDAPS authentication using ldp.exe. Open ldp.exe, select Connection > Connect, enter the LDAPS service name in the Server field, enter 636 in the Port field, check the box next to SSL, and click OK.
ldp.exe Connection Settings
A successful connection confirms that TLS was negotiated with the LDAPS service name and returns the domain controller’s rootDSE information. The dnsHostName attribute identifies which domain controller the load balancer selected to service the request.
Successful LDAPS Connection
Next, select Connection > Bind, enter the username and password of a test account in the User and Password fields, choose Simple bind, and click OK.
ldp.exe Simple Bind Settings
A successful bind returns the message Authenticated as followed by the test account name, confirming that the LDAPS service is functioning correctly.
Successful LDAPS Simple Bind
Monitoring
Update-DcLdapsCertificate.ps1 records key outcomes in the Application event log using the event source Update-DcLdapsCertificate. Administrators can monitor these events to confirm renewals are processed successfully and to identify problems before the certificate expires.
| Event ID | Level | Description |
|---|---|---|
| 1000 | Information | New certificate imported into the NTDS service certificate store and verified |
| 1001 | Information | Selected certificate is already bound to the NTDS service certificate store |
| 1002 | Information | Previous certificate removed from the NTDS service certificate store |
| 1003 | Information | LDAPS verified to be serving the new certificate |
| 2000 | Warning | Previous certificate not found in the NTDS service certificate store during cleanup |
| 2001 | Warning | Unable to signal AD DS to reload its server certificate |
| 2002 | Warning | LDAPS is serving a certificate other than the newly bound certificate |
| 2003 | Warning | Unable to complete a TLS handshake to verify the LDAPS certificate |
| 3000 | Error | The script terminated with an error |
In addition, a detailed transcript of each run is written to %ProgramData%\RMHCI\PowerShell\Update-DcLdapsCertificate.log. Administrators can also monitor the LDAPS certificate externally using a certificate monitoring service such as CertKit, which supports internal TLS services, including LDAPS on domain controllers.
Summary
Providing a highly available LDAPS service for non-Windows systems eliminates clear-text credentials on the network and removes the single point of failure that comes with pointing devices at individual domain controllers. Placing domain controllers behind a load balancer with a dedicated service name, issuing certificates that cover every name clients may use, and automating the binding of renewed certificates to the NTDS service certificate store ensures the service remains available and secure without ongoing manual intervention.
Additional Information
- Building High Available LDAPS Architectures
- Active Directory LDAPS Certificate Selection Deep Dive
- LDAP Signing and Channel Binding in Windows Server
- Lightweight Directory Access Protocol (LDAP): The Protocol (RFC 4511)
- Simple Authentication and Security Layer (SASL) (RFC 4422)
- The Case for Short-Lived Certificates in Enterprise Environments
- Intranet Certificate Monitoring with CertKit
- Update-DcLdapsCertificate.ps1 and Register-DcLdapsCertificateTask.ps1 on GitHub
- Get-TlsCertificate.ps1 on GitHub
- ServiceCertStore PowerShell Module






























