Cloudek.Request a service session

Microsoft Entra

Configure Secure LDAP (LDAPS) in Microsoft Entra Domain Services Without Exposing Endpoints

Plan LDAPS for Entra Domain Services with certificate, network, client testing, rotation and rollback checks before enabling access.

Why secure LDAP needs a plan

LDAP can expose credentials and directory queries when used without transport encryption. Microsoft Entra Domain Services supports Secure LDAP, also called LDAPS, for applications that need LDAP over TLS. Enabling it is not just a certificate upload: the certificate name, private-key handling, DNS, client trust, network path, bind method and rotation process all need to line up.

This guide is a planning checklist, not a tenant-specific change procedure. Microsoft Learn pages were checked on 24 November 2026. Follow the current Secure LDAP tutorial and its troubleshooting guide for your service configuration. No commands in this article have been run against a tenant.

Confirm the need and boundary

First identify the application that requires LDAP, its owner, the directory data it reads, its bind account, its expected DNS name and where it runs. Confirm that it can use LDAPS and validate certificates. If the application can use a modern identity protocol, compare that path as well. Avoid opening a network path merely because an old configuration uses port 389; establish which protocol and endpoint are actually required.

Microsoft Entra Domain Services is a managed domain. Secure LDAP is configured on the managed domain, while client applications connect using a DNS name and a network route that can reach the service. Microsoft documents public secure LDAP as disabled by default. Prefer a private path from the managed domain's virtual network, or a deliberately peered network with working DNS and routes, before considering public access. The Entra architecture guide explains where Domain Services fits; the setup and limits guide, Group Policy migration plan and managed versus self-managed AD DS comparison cover adjacent design decisions. For a narrowly scoped NSG rule, the IPv4 subnet calculator can help check a CIDR range; it does not validate your network policy. If public access is required, treat it as a separately reviewed exception and restrict source addresses.

Certificate requirements

The certificate must identify the managed domain in a way the clients and service can validate. Microsoft’s tutorial says the DNS name or subject alternative name must be a wildcard certificate for Domain Services; the managed domain’s domain controllers can have random names as service instances change. Microsoft also lists key usage for digital signatures and key encipherment, and the certificate purpose must allow TLS server authentication.

These LDAPS certificate requirements should be checked as a set: name, key usage, server-authentication purpose, private-key availability, trust chain and expiry. A certificate can be valid in one respect and still fail the Domain Services validation or client handshake.

The service needs the private key. Microsoft requires a PFX file that includes it when applying the certificate to the managed domain. Clients need to trust the issuing certificate chain; distribute only the public certificate to client trust stores when needed. Keep the PFX and password in approved restricted handling, and never place either in source control, tickets, chat or an example command.

Microsoft’s tutorial also notes that a public certification authority cannot issue a certificate for the default .onmicrosoft.com domain because Microsoft owns that domain. Review the current certificate guidance for supported alternatives in your domain scenario. Do not assume that any certificate with a plausible subject name will be accepted.

Microsoft requires the certificate to remain valid for at least the next three to six months at enablement; expiry disrupts LDAPS. Name a renewal owner and record the expiry date, issuing CA, subject/SAN pattern, key usage and distribution method in a restricted operational record. Do not paste the PFX, private key, password or full certificate chain into an article, public issue or general change log.

Private network first

Map the caller’s subnet, DNS resolver, route, firewall and network security group (NSG) path. Confirm the managed-domain name resolves to the expected private address from the application subnet. Review inbound and outbound rules, existing deny rules and any network virtual appliances. A successful DNS lookup does not prove that a TLS session can reach the endpoint, and an open port does not prove the certificate name is correct.

Use a test host that follows the same route and DNS policy as the application. Validate that the client reaches the expected endpoint over TCP 636 and negotiates TLS with a trusted certificate. Then perform a bind and a minimal approved directory query. Keep test scope narrow: use a designated test account and a harmless base DN. Do not place real credentials or returned directory entries in logs or screenshots.

If public LDAPS is genuinely required

Microsoft warns that exposing the managed domain over the internet on TCP 636 creates a security threat. If the workload cannot use private connectivity, document the business dependency, data queried, source networks and owner approval. Restrict the inbound NSG rule to known source IP addresses or CIDR ranges; avoid a broad Any or unrestricted internet source. Confirm how the source addresses are maintained and who reviews changes.

For external access, plan the DNS record, certificate name and client trust together. Microsoft’s tutorial describes configuring a DNS host record for the LDAPS endpoint after public secure LDAP is enabled. Use a DNS name rather than an IP address for TLS validation; Microsoft’s troubleshooting guidance calls this out. Review exposure from an external network, verify the NSG filter, and test that unapproved sources cannot connect. Do not infer safety from the port being encrypted: network exposure and authentication risks remain.

Lab-only certificate example

Microsoft’s Secure LDAP tutorial shows creating a self-signed certificate using New-SelfSignedCertificate as an example. Keep that approach in a lab or controlled test where clients explicitly trust the certificate. The following uses a reserved synthetic domain and mirrors the Learn example, with export policy made explicit; it is not a production certificate procedure. See the New-SelfSignedCertificate reference for the cmdlet parameters.

$dnsName = "aaddscontoso.com"
$lifetime = Get-Date
New-SelfSignedCertificate -Subject *.$dnsName `
  -NotAfter $lifetime.AddDays(365) -KeyUsage DigitalSignature, KeyEncipherment `
  -KeyExportPolicy Exportable `
  -Type SSLServerAuthentication -DnsName *.$dnsName, $dnsName

Production systems should use the organisation’s approved public or enterprise CA process, with key protection, issuance, renewal and revocation handled by the certificate owner. The certificate must have an exportable private key so an authorised operator can export the required PFX for the managed domain. Follow the current Microsoft steps for export format and encryption; do not place the PFX or its password in a command example.

Do not copy an example command into production without reviewing the subject/SAN, key usage, server-authentication purpose, exportability, key protection and expiration. The certificate name must match the Domain Services managed-domain DNS name according to Microsoft’s current requirements. The PFX export contains sensitive key material; transfer it only through the approved secure workflow.

Client trust and test sequence

  1. Confirm the managed-domain DNS name and the client’s DNS response from the same network path the application uses.
  2. Check that the client trusts the certificate issuer and that its clock is correct. Inspect certificate expiry, name match, TLS server-authentication purpose and required key usage.
  3. Check TCP 636 reachability through the intended route and NSG. Treat this as a network test only, not proof that LDAP bind works.
  4. Use LDP.exe from the Remote Server Administration Tools (RSAT) package. Connect using the DNS name, select port 636 and SSL, then bind with an approved test identity. Microsoft’s tutorial documents this sequence.
  5. Query only the minimum test object or container required to validate the application’s behaviour. Avoid retaining returned names or attributes in general logs.
  6. Test from the application host or a faithful staging environment. A successful workstation test does not prove the application subnet has the same DNS, routes and trust.
  7. Record the result, certificate thumbprint in the restricted operations record, test time, operator and any exception. Do not record secrets or directory rows.

For a quick reachability check from Windows PowerShell, an administrator may use Test-NetConnection -ComputerName <managed-domain-dns-name> -Port 636. This only confirms a TCP connection attempt; it does not validate the LDAPS certificate, bind or query. The more complete test in Microsoft’s tutorial uses LDP.exe with SSL selected.

Certificate rotation and rollback

Plan certificate rotation before enabling the integration. Name the CA and service owners, renewal lead time, test environment, deployment window, client trust distribution, managed-domain upload step, validation checks and rollback decision-maker. Microsoft documents replacing an expiring certificate through the Secure LDAP configuration and distributing the public certificate to clients as required.

Keep the replacement certificate prepared and validated before changing the active certificate. Test DNS name, certificate chain, TLS handshake, bind and a minimal query after the change. If a client fails, check its DNS result, port path, trusted issuer, certificate name, expiry, clock and bind configuration in that order. For rollback from public exposure, disable internet access for Secure LDAP and remove the corresponding public TCP 636 NSG allow rule. Then restore the last known-good certificate through the documented Secure LDAP procedure if the service still needs to remain enabled. Do not open wider network access to silence a failure.

Troubleshooting order

Name resolution: confirm the configured DNS name resolves from the caller network to the intended service endpoint. Test the application’s resolver, not only a laptop on a different network.

Network path: verify the route, NSG and firewall permit TCP 636 from the intended source. For public access, confirm only approved source ranges are allowed.

TLS and name matching: use the DNS name, not an IP literal. Check wildcard name, issuer trust, expiry, server authentication and key-usage requirements. Microsoft notes that spelling and certificate selection problems can prevent the managed domain from using the certificate.

Bind and password hashes: a TLS connection can succeed while a bind fails. Check the account, domain format and password synchronisation requirements. Microsoft notes that simple binds cannot work when NTLM password-hash synchronisation is disabled for the managed domain.

Application behaviour: confirm the base DN, query filters, referrals, timeout and expected attributes with the application vendor or owner. Do not turn a certificate issue into a broad permission or firewall exception.

Common mistakes

  • Uploading a CER without the private key instead of the required PFX for the managed domain.
  • Using a certificate whose name does not satisfy the wildcard requirement for the managed domain.
  • Distributing the private key to clients when they only need the public certificate and issuer trust.
  • Enabling internet access before documenting the need and restricting source IPs.
  • Testing TCP reachability and calling it an LDAPS success without a trusted TLS session and bind.
  • Using an IP address for the client connection and then troubleshooting a name mismatch.
  • Enabling the service without a rotation owner, expiry alert and rollback plan.

Microsoft sources checked on 24 November 2026

Frequently asked questions

Which certificate format does Entra Domain Services need?

Microsoft's tutorial requires a PFX that includes the private key for the managed domain. Client computers need to trust the issuer and can receive the public certificate without the private key. Protect and restrict access to the PFX and its password.

Can I enable LDAPS on the default onmicrosoft.com domain with a public certificate?

Microsoft says a public CA cannot issue a certificate for the Microsoft-owned default onmicrosoft.com domain. Check the current tutorial for the certificate and domain requirements that apply to your managed-domain name.

Should I expose port 636 to the internet?

Secure LDAP access over the internet is disabled by default. Microsoft warns that public access creates a security threat and recommends restricting TCP 636 to known source IP addresses with a network security group. Prefer private connectivity when it meets the application requirement.

How do I test an LDAPS connection?

Microsoft's tutorial uses LDP.exe: connect by DNS name on port 636 with SSL selected, then bind using an approved test account. Also check name resolution, network rules, certificate trust, expiry and server-authentication usage.

Was this helpful?