Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

Active Directory Domain Services Basics

By Kokil Thapa | Last reviewed: September 2026

Active Directory Domain Services basics matter the moment your Laravel API, internal portal, or file share must authenticate against a corporate Windows domain. AD DS is Microsoft's directory service for identity, policy, and name resolution inside an organisation. If you deploy Linux servers alongside Windows clients—as I do on many Linux system administration engagements—you still need a clear mental model of how domains, forests, and trust relationships work. This guide covers the architecture, core protocols, and practical integration points a full-stack engineer actually touches.

What is Active Directory Domain Services and why does it matter?

Active Directory Domain Services (AD DS) is the role on Windows Server that implements a multi-master replicated directory. It is not the same thing as Azure AD Entra ID, though the names confuse people constantly. On-premises AD DS stores security principals and configuration in a database called NTDS.dit on each domain controller.

For web developers, AD DS usually appears at the edge of the stack. Your app may never write to AD directly. Instead, IT provisions accounts in AD, and your application reads identity through LDAP bind, SAML federation, or an OAuth bridge like ADFS or Entra ID Connect. On a legal-tech portal I built, client staff logged in with email passwords stored in Laravel—but the firm's internal document reviewers used domain accounts on the LAN. Two identity planes, one business.

AD DS provides four services most teams rely on daily:

  • Directory store — hierarchical objects with attributes (userPrincipalName, memberOf, lastLogon).
  • Authentication — Kerberos tickets and NTLM challenges for Windows and compatible clients.
  • Authorization context — group membership drives file ACLs, VPN access, and app roles.
  • Policy delivery — Group Policy Objects (GPOs) push settings to users and computers.

Microsoft documents the core concepts in the Active Directory Domain Services overview. That page remains the authoritative starting point when terminology drifts.

Forest (one schema, shared config partition)Domain: corp.example.comUsers, groups, computersDC 1DC 2Child domain: dev.corpDC 3DC 4Organizational UnitsIT, HR, ServersGPO links attach hereGlobal CatalogForest-wide searchPartial attribute setDNS zonesSRV records_ldap._tcp
Active Directory Domain Services basics: a forest contains domains, domain controllers, OUs, and DNS-integrated zones.

How does an Active Directory domain hierarchy work?

Think of AD DS as a tree of containers. The forest is the security boundary. Domains inside a forest share a schema and configuration partition. Organizational Units (OUs) subdivide a domain for delegation and Group Policy targeting.

Forest, domain, and trust in plain terms

A single-company deployment often runs one forest and one domain. That keeps operations simple. Acquisitions or strict regulatory separation may require multiple forests with explicit trust relationships. Trust direction and transitivity determine whether users in domain A can access resources in domain B.

Each object has a distinguished name (DN). A typical user DN looks like CN=Jane Doe,OU=Staff,DC=corp,DC=example,DC=com. LDAP clients use this path during bind and search operations. The regex tester on this site helps when you debug filter strings like (sAMAccountName=jdoe) before pasting them into production config.

FSMO roles you should recognise

AD DS is multi-master for most attributes, but five Flexible Single Master Operations roles prevent write conflicts:

  1. Schema Master — controls schema extensions (one per forest).
  2. Domain Naming Master — adds or removes domains (one per forest).
  3. RID Master — allocates relative IDs for SIDs (one per domain).
  4. PDC Emulator — time sync anchor, password changes, legacy NTLM (one per domain).
  5. Infrastructure Master — cross-domain object references (one per domain).

You rarely touch FSMO daily. You do notice when the PDC Emulator clock drifts and Kerberos returns generic "login failed" errors. Time skew beyond five minutes breaks ticket validation.

Replication and sites

Domain controllers replicate the directory via multi-master replication. Sites and subnets map your physical network to replication topology. Place at least two DCs in production. A single DC is a single point of failure and a restore nightmare.

This mirrors lessons from distributed database basics. Eventual consistency, conflict handling, and placement rules matter—even when the datastore is four decades of Microsoft enterprise practice rather than Cassandra.

Kerberos login flow (Active Directory)Client PC1. AS-REQusernameDomain ControllerKDC service2. AS-REPTGT issued3. TGS-REQfor service SPN4. TGS-REPservice ticketFile / AppserverClock sync with PDC Emulator is mandatory
Kerberos ticket exchange is core to Active Directory Domain Services basics—TGT first, then a service ticket bound to an SPN.

How do you install and promote a Windows Server to a domain controller?

Greenfield lab work teaches AD DS faster than reading alone. Use isolated virtual machines. Never experiment on a production forest without change control and backups.

Prerequisites checklist

Before promotion, confirm these items:

  • Static IP on the server that will become the first DC.
  • DNS pointing to itself (127.0.0.1 is wrong for AD—use the server's actual IP).
  • Hostname decided upfront; renaming a DC later is painful.
  • Strong Directory Services Restore Mode (DSRM) password stored in your vault.

DNS integration is non-negotiable. AD DS registers SRV records clients use to locate LDAP and Kerberos services. The parallel on the Linux side is careful domain and DNS planning before any public-facing site goes live—wrong naming is expensive to unwind.

Install the AD DS role and promote

On Windows Server 2022 or 2025, open PowerShell as Administrator:

# Install AD DS management tools and the role
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools

# Promote to new forest (first DC)
Import-Module ADDSDeployment
Install-ADDSForest `
  -DomainName "corp.example.com" `
  -DomainMode "WinThreshold" `
  -ForestMode "WinThreshold" `
  -InstallDns:$true `
  -SafeModeAdministratorPassword (ConvertTo-SecureString "YourDSRM-Pass!" -AsPlainText -Force) `
  -Force:$true

The server reboots automatically. After restart, verify with:

Get-ADDomain
Get-ADForest
dcdiag /v

dcdiag surfaces DNS registration gaps, replication failures, and FSMO problems early. Treat warnings seriously in production.

Add a second domain controller

Join another Windows Server to the domain, then promote it:

Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
Install-ADDSDomainController `
  -DomainName "corp.example.com" `
  -InstallDns:$true `
  -SafeModeAdministratorPassword (ConvertTo-SecureString "YourDSRM-Pass!" -AsPlainText -Force) `
  -Force:$true

Two DCs give you replication and a path to survive one host failure. Backup Active Directory with Windows Server Backup or VSS-aware tools on a schedule you can restore from—not just file copies of NTDS.dit while the service runs unclean.

How do LDAP and Kerberos integrate with web applications?

Most PHP and Laravel deployments I maintain authenticate against the application's own user table. Enterprise clients sometimes require AD integration for staff SSO. You have three common patterns.

LDAP bind against AD DS

Your app binds to TCP 389 (or 636 with LDAPS) and validates credentials. Read-only service accounts should search the directory; never embed a domain admin in .env.

Example LDAP URI and base DN configuration concepts:

LDAP_HOST=ldap.corp.example.com
LDAP_PORT=636
LDAP_BASE_DN=DC=corp,DC=example,DC=com
LDAP_USER_DN=CN=svc_ldap,OU=ServiceAccounts,DC=corp,DC=example,DC=com

PHP's ldap_bind() or Laravel packages wrapping LDAPRecord perform the bind. Map memberOf to application roles explicitly. Do not assume every AD group should become an admin.

The LDAP v3 specification is defined in RFC 4511. AD implements a practical subset with Microsoft-specific attributes documented on Microsoft Learn.

Kerberos and SPNs for service auth

Kerberos requires Service Principal Names registered on the account running the service. A duplicate or missing SPN triggers the classic "Cannot generate SSPI context" error on SQL Server or IIS apps. Use setspn -L serviceaccount to audit registrations before go-live.

Modern federation instead of direct LDAP

Many 2026 deployments federate Entra ID (Azure AD) to SaaS apps via OpenID Connect. On-prem AD DS syncs upward through Entra Connect. Your API development work then validates JWT access tokens instead of opening LDAP from a cloud VPS—which firewalls often block anyway.

For hybrid stacks, I've placed Laravel on Ubuntu behind Nginx while staff authenticated through Entra ID SAML. AD DS stayed inside the client's LAN. The web tier never joined the domain. That separation reduces attack surface compared to domain-joining every app server.

ApproachBest forTrade-offs
LDAP bindInternal apps on LAN, legacy PHPRequires LDAPS, credential handling, no MFA unless added
Kerberos/SPNEGOIIS/.NET intranet SSOComplex SPN hygiene; poor fit for stateless REST
SAML/OIDC via Entra IDCloud and hybrid SaaS, mobileNeeds sync/connect; external dependency on IdP uptime
Local app usersPublic customer portalsSeparate provisioning; no Windows password policy
Hybrid identity: on-prem AD to web appAD DS on LANDomain controllersEntra Connectsync users/groupsEntra ID cloudOIDC / SAMLLinux app serverLaravel / NginxOptional LDAPSdirect bind pathPrefer federation for cloud-facing appsReserve LDAP bind for internal VLAN-only services
Active Directory Domain Services basics in hybrid deployments: sync to Entra ID, federate to apps, avoid exposing LDAP to the public internet.

What are common Active Directory security and Group Policy practices?

AD DS is the keys to the kingdom. Compromise one Domain Admin account and an attacker owns every workstation, file share, and often backup systems. Security frameworks like ISO 27001 basics for engineers map cleanly onto AD hardening because identity is central to every control family.

Tiered Administration Model

Microsoft's tier model separates:

  • Tier 0 — domain controllers, AD admins (no email browsing on these accounts).
  • Tier 1 — servers and applications.
  • Tier 2 — workstations and helpdesk tasks.

Use separate admin accounts per tier. Block Tier 0 credentials from logging onto Tier 2 workstations via GPO "Deny log on locally" and Restricted Groups where appropriate.

Group Policy essentials

GPOs link to OUs and filter by security groups. Common settings include password policy, screen lock, firewall rules, and software deployment. Order matters: LSDOU—Local, Site, Domain, OU—with later links overriding earlier ones unless blocked.

Audit GPO changes. An attacker with GPO write access can deploy scheduled tasks running as SYSTEM across thousands of PCs within minutes.

Passwords, lockout, and privileged access

Enforce length over rotation theatre. NIST SP 800-63B influenced many orgs to drop arbitrary 90-day password changes without compromise evidence. Enable Account Lockout Policy to slow brute force. Protect service accounts with managed passwords or gMSA where the app supports it.

Generate initial break-glass passwords with a proper tool—your password generator beats Welcome1! every time. Store them offline in a sealed envelope or hardware vault.

Monitoring and recovery

Enable advanced auditing for logon events, directory service changes, and Group Policy modifications. Forward events to a SIEM isolated from Domain Admin control. Test AD restore quarterly in a lab. I've seen teams discover too late that their backup could not authoritatively restore the RID pool.

Linux-side hardening parallels exist. SELinux basics for administrators and AD tiering both pursue least privilege—different mechanisms, same goal.

Tiered Admin Model (security boundary)Tier 0 — Domain ControllersEnterprise Admins, Schema AdminsTier 1 — Member ServersApp admins, SQL operatorsTier 2 — WorkstationsHelpdesk, standard usersNever use Tier 0 creds on Tier 2 devices
Security-focused Active Directory Domain Services basics: tiered admin limits lateral movement after a workstation compromise.

How does Active Directory compare to Linux-centric identity systems?

Teams running mostly Ubuntu app servers still encounter AD DS from clients, partners, or acquired companies. The mental model differs but overlaps.

FreeIPA and Samba AD provide AD-compatible domains on Linux. They suit lab and branch-office scenarios. Full Microsoft AD DS remains the default in Windows-heavy enterprises. For custom portals—like those in our Mijar Law Associates client portal portfolio—public users rarely touch AD at all. Internal IT staff might, via VPN, for file shares and Exchange legacy systems.

When you build enterprise applications, clarify identity requirements in discovery. Ask whether users live in AD, Google Workspace, or a bespoke table. The wrong assumption costs weeks of refactor.

Operational tasks on Linux—systemd service management, performance tuning, writing systemd units—do not replace AD skills. They complement them in hybrid environments where PHP 8.5 and Laravel 13 apps run on Ubuntu while HR runs on Windows.

Configuration management tools can join Linux hosts to AD realms for authentication. Puppet configuration management basics show how policy-as-code parallels GPO—declarative desired state, enforced continuously.

For ongoing operations, pair directory expertise with support and maintenance contracts that cover both the web tier and the identity dependencies documented in your runbook.

Key Takeaways

  • AD DS is the on-premises directory for users, groups, computers, and GPO—distinct from Entra ID though often synced.
  • Always run at least two domain controllers and integrated DNS with correct SRV records.
  • Kerberos needs time sync and correct SPNs; LDAP needs LDAPS and least-privilege service accounts.
  • Prefer SAML/OIDC federation for cloud-facing apps instead of exposing LDAP to the internet.
  • Apply tiered administration and test AD backups before you need an authoritative restore.
  • Clarify identity boundaries early when mixing Laravel apps with corporate Windows domains.

People Also Ask

What is the difference between Active Directory and Active Directory Domain Services?

Active Directory is the umbrella brand for Microsoft's identity services. AD DS is the specific server role that stores the directory database and handles Kerberos authentication on domain controllers. Azure AD Entra ID is the cloud directory; it relates to AD DS through sync tools but does not replace on-prem DCs in every scenario.

Do I need Active Directory for a small business?

Shops with fewer than twenty Windows PCs often use Entra ID with cloud accounts and avoid on-prem DCs entirely. Once you depend on roaming profiles, central file ACLs, legacy on-prem apps, or strict GPO compliance, AD DS or an AD-compatible alternative becomes worthwhile. Cost the hardware, licensing, and admin time honestly—often Rs 15,000–40,000/month (~USD 110–300) in managed service fees for tiny teams.

Can Linux servers join an Active Directory domain?

Yes. Realmd, SSSD, and Samba winbind join Linux hosts to AD for user authentication and sudo rules. Web applications more commonly use LDAP or federated SSO rather than joining the server itself to the domain. Join only when you need OS-level single sign-on or unified uid mapping.

How often should Active Directory be backed up?

Back up at least one domain controller daily with System State or equivalent application-aware backup. Include DSRM-tested restores in your DR plan. AD replication is not backup—accidental object deletion replicates just as quickly as legitimate changes.

Put Active Directory Domain Services basics into your project plan

Active Directory Domain Services basics are not academic for hybrid teams. They explain why LDAP bind fails from your cloud VPS, why Kerberos clocks matter, and why your enterprise client insists on Entra ID SAML instead of local passwords. Map identity early, keep tier separation strict, and document which systems actually touch the forest. If you are planning a portal, API, or internal tool that must coexist with a Windows domain, review our custom software development approach or about me page, then contact us to align the web stack with your directory reality.

Frequently Asked Questions

AD DS is the Windows Server role that implements a multi-master replicated directory storing users, groups, computers, and policy. Domain controllers authenticate clients via Kerberos or NTLM and deliver settings through Group Policy Objects.

Active Directory is Microsoft's umbrella identity brand. AD DS is the on-premises server role that stores objects in NTDS.dit on domain controllers and handles Kerberos on your LAN. Azure AD Entra ID is the cloud directory. They relate through sync tools like Entra Connect, but Entra ID does not replace on-prem AD DS. Names confuse people constantly. For web developers, AD DS usually sits at the edge of the stack while apps authenticate via LDAP, SAML, or OAuth bridges rather than writing to the directory directly.

At least two. One DC is a single point of failure and a restore nightmare.

A forest is the top security boundary. Domains inside a forest share schema and configuration. Organizational Units subdivide domains for delegation and Group Policy targeting. Single-company setups often run one forest and one domain. Acquisitions may need multiple forests with explicit trusts. Each object has a distinguished name like CN=Jane Doe,OU=Staff,DC=corp,DC=example,DC=com that LDAP clients use during bind and search. Trust direction and transitivity control whether users in one domain access resources in another. Sites and subnets map physical networks to replication topology.

AD DS is multi-master for most writes, but five Flexible Single Master Operations roles prevent conflicts. Schema Master and Domain Naming Master are one per forest. RID Master, PDC Emulator, and Infrastructure Master are one per domain. You rarely touch FSMO daily, but PDC Emulator drift breaks Kerberos when clocks skew beyond five minutes, producing generic login failures. Infrastructure Master handles cross-domain references. dcdiag /v surfaces FSMO and replication problems early. Treat warnings seriously before they become production outages.

Use isolated VMs for lab work, never production without change control. Prerequisites: static IP, DNS pointing to the server's actual IP not 127.0.0.1, hostname decided upfront, and a strong DSRM password in your vault. On Windows Server 2022 or 2025, run Install-WindowsFeature AD-Domain-Services, then Install-ADDSForest for the first DC or Install-ADDSDomainController for additional ones. Include -InstallDns:$true because AD registers SRV records clients need. After reboot, verify with Get-ADDomain, Get-ADForest, and dcdiag /v.

Most PHP and Laravel apps use local user tables, but enterprise clients sometimes require AD SSO. LDAP bind connects to port 389 or 636 with LDAPS, validates credentials via ldap_bind or packages like LDAPRecord, and maps memberOf to app roles explicitly. Kerberos needs Service Principal Names on the service account and suits IIS intranet SSO poorly for stateless REST. Modern hybrid deployments federate Entra ID via OpenID Connect or SAML while AD DS syncs upward through Entra Connect, so cloud APIs validate JWT tokens instead of exposing LDAP.

LDAP bind fits internal LAN apps and legacy PHP where direct directory access is allowed. It requires LDAPS, careful credential handling, and added MFA if needed. Kerberos and SPNEGO suit IIS and .NET intranet SSO but demand strict SPN hygiene. SAML or OIDC via Entra ID is best for cloud, hybrid SaaS, and mobile because firewalls often block LDAP from public VPS hosts. I've placed Laravel on Ubuntu behind Nginx while staff authenticated through Entra ID SAML, keeping AD DS inside the LAN and reducing attack surface versus domain-joining every app server.

GPOs push settings to users and computers linked to OUs, filtered by security groups. Common settings include password policy, screen lock, firewall rules, and software deployment. Precedence follows LSDOU: Local, Site, Domain, OU, with later links overriding earlier unless blocked. An attacker with GPO write access can deploy scheduled tasks running as SYSTEM across thousands of PCs within minutes, so audit GPO changes. Order and targeting matter as much as the settings themselves. Puppet and other configuration management tools pursue a similar declarative desired-state model on Linux.

Microsoft's tier model separates Tier 0 domain controllers and AD admins from Tier 1 servers and applications and Tier 2 workstations and helpdesk tasks. Use separate admin accounts per tier. Block Tier 0 credentials from logging onto workstations via GPO Deny log on locally and Restricted Groups. AD DS is the keys to the kingdom: compromise one Domain Admin and an attacker owns workstations, file shares, and often backups. This parallels least-privilege goals on Linux with SELinux, different mechanism, same intent. Forward audit events to a SIEM isolated from Domain Admin control.

Kerberos ticket exchange requires synchronized clocks. The PDC Emulator is the time sync anchor for the domain and handles password changes plus legacy NTLM. Time skew beyond five minutes breaks ticket validation and returns generic login failed errors that are hard to diagnose without checking the PDC Emulator first. Always verify NTP configuration on domain controllers during troubleshooting. Kerberos also depends on correct Service Principal Names; duplicate or missing SPNs trigger Cannot generate SSPI context on SQL Server or IIS. Audit with setspn -L before go-live.

DNS integration is non-negotiable. AD DS registers SRV records clients use to locate LDAP and Kerberos services. Before promoting the first DC, point DNS to the server's actual IP, not 127.0.0.1. Include -InstallDns:$true during promotion. dcdiag surfaces DNS registration gaps alongside replication failures. Wrong DNS planning is expensive to unwind, similar to careful domain planning before any public-facing site goes live. Clients resolve domain controllers through these records during authentication and policy delivery.

FreeIPA and Samba AD provide AD-compatible domains on Linux and suit lab or branch-office scenarios. Full Microsoft AD DS remains the default in Windows-heavy enterprises. Teams running Ubuntu app servers still encounter AD from clients, partners, or acquisitions. Configuration management can join Linux hosts to AD realms for authentication. For custom portals, public users rarely touch AD; internal IT may access file shares via VPN. Clarify in discovery whether users live in AD, Google Workspace, or a bespoke table. The wrong assumption costs weeks of refactor.

Bind with a read-only service account, never embed domain admin credentials in .env. Typical concepts include LDAP_HOST, LDAP_PORT 636 for LDAPS, LDAP_BASE_DN like DC=corp,DC=example,DC=com, and LDAP_USER_DN for the service account. PHP ldap_bind or Laravel LDAPRecord packages perform the bind. Map memberOf to application roles explicitly and do not assume every AD group should become admin. AD implements an LDAP v3 subset with Microsoft-specific attributes. Protect connections with LDAPS on port 636 rather than cleartext 389 across untrusted networks.

Schedule backups with Windows Server Backup or VSS-aware tools you can actually restore from, not unclean file copies of NTDS.dit while the service runs. Test AD restore quarterly in a lab. Teams have discovered too late that backups could not authoritatively restore the RID pool. Store DSRM passwords offline in a vault or sealed envelope. Generate break-glass credentials with a proper password generator, not Welcome1. Enable advanced auditing for logon events, directory service changes, and Group Policy modifications. At least two DCs give replication and a path to survive one host failure.

Share this article

0 Comments

Leave a comment

Your email is not published. Comments appear once they have been read. Sign in to have your details filled in.

Quick Contact Options
Choose how you want to connect me: