Forum Discussion
Active Directory Restoration in Isolated Environment
Introduction:
Active Directory is centralized Database which stores the objects like users, groups, computers, printers, shares, service accounts in an hierarchical structure. It is one of the most critical and important services in IT Infrastructure as it provides centralized authentication and authorization, allows administrators to manage access to resources, enforce security policies etc.,
Objective \ Purpose:
The purpose of this article is to provide detailed steps to recover the entire Active Directory forest from Good Backup taken using native backup "Windows Server Backup" and Backup taken through "Azure VM Backup" in an isolated environment to check the backup working status. This builds the confidence of restoring the AD and bringing to production in case of a disaster like complete loss of Production domain or malware attack or any other attack etc.,
Environment Background:
-----------------------------
In this article, the Active Directory environment is considered to be having Root domain as test.com and Child Domain as child.test.com in Azure Cloud. Operating system used is Windows server 2019 and Windows server 2025.
Recovery Approaches:
-------------------------
Active Directory can be recovered using many methods, viz.,
1. Active directories recycle bin: To restore only the deleted objects, but this option is not suitable for recovering complete AD
2. System State Backup: This helps in restoring Active Directory Database in DSRM mode by marking authoritative or non-authoritative based on requirement.
3. Complete VM Backup: This is the best option to restore complete Domain Controller
Building the Isolated Environment in Azure:
------------------------------------------------
1. Create a separate VNET
2. Subnet for Azure Bastion and Subnet for deploying virtual machine
3. NSG to allow only communication inside the VNET and block other communications
Restore Procedure:
--------------------------
Restoring the Root Domain DC:
1. Search the domain Controller VM in Azure console
2. Select recover and create new
3. Fill in the details of the isolated environment so that the VM will be re-created
4. Login with domain admin privileges
5. Verify the DNS assigned using IPCONFIG /ALL
6. Change the DNS IP address on network properties to Server IP Address
7. Perform Ipconfig /registerdns so that the IP of new DC will be updated
8. Run Command : Net Share to check SYSVOL and NETLOGON is showing up
9. Boot the system into DSRM Mode by selecting the option in msconfig
10. Once it is booted in DSRM Mode, login using local administrator credential
If it is needed to restore the system state of any other date after restoring the complete VM, then using "Windows Server Backup Wizard" choose recover and follow the steps; else skip this step and continue with step 11.
>Select Backup Location
>Specify the backup source
>Select date and time
>Select the recovery type as system restore
>Recovery options as Original
>Review and Confirm
11. Open Command Prompt as administrator and mark all the naming context as authoritative using ntdsutil
>ntdsutil
>activate instance ntds
>authoritative restore
>restore subtree "DC=test,DC=com"
Repeat the above steps for the other Naming context like "CN=Configuration,DC=test,DC=com", "CN=Schema,CN=Configuration,DC=test,DC=com", "DC=ForestDNSZones,DC=test,DC=com", "DC=DomainDNSZones,DC=test,DC=com" as well.
Reboot the server in normal mode and perform the following steps for making sysvol as authoritative:
Mark the sysvol as authoritative by changing the msDFSR-Enabled value to 1
>net stop dfsr
>Open Active Directory Users and Computers, go to View and enable Advanced Features
>Navigate to Domain Controllers -> Your DC -> DFSR-Localsettings -> Domain System Volume
>Right-click SYSVOL Subscription, select Properties, and then Attribute Editor
>Find msDFSR-Options, click Edit, change the value to 1, and click OK
>Run repadmin /syncall /Aed from an elevated command prompt to force replication of the AD changes
>Run net start dfsr in an elevated command prompt on the authoritative DC.
>Run dfsrdiag /pollad from an elevated command prompt on the authoritative DC
Verify the domain controller is holding the FSMO roles if not seize the roles. Steps are as follows:
>ntdsutil
>Roles
>Connections
>Connect to Server <Recovered VM>
>quit
>seize PDC Emulator
Repeat the above steps to seize the other roles (Infrastructure, Schema master, RID Master and Domain Naming master)
Check the time synchronization by using w32tm /query /source.
Now Domain Controller is completely recovered from backup. Check the health of domain controller using DCDIAG Command.
Restoring the Child Domain DC:
1. Search the domain Controller VM in Azure console
2. Select recover and create new
3. Fill in the details of the isolated environment so that the VM will be recreated
4. login with domain admin privileges
5. Verify the DNS assigned using IPCONFIG /ALL
6. Change the DNS IP address on network properties to Server IP Address
7. Perform Ipconfig /registerdns so that the IP of new DC will be updated
8. Run Command : Net Share to check SYSVOL and NETLOGON is showing up
9. Boot the system into DSRM Mode by selecting the option in msconfig
10. Once it is booted in DSRM Mode, login using local administrator credential
If it is needed to restore the system state of any other date after restoring the complete VM then using "Windows Server Backup Wizard" choose recover and follow the steps; else skip this step and continue with step 11.
>Select Backup Location
>Specify the backup source
>Select date and time
>Select the recovery type as system restore
>Recovery options as Original
>Review and Confirm
11. Open Command Prompt as administrator and mark all the naming context as authoritative using ntdsutil
>ntdsutil
>activate instance ntds
>authoritative restore
>restore subtree "DC=Child,DC=test,DC=com"
Repeat the above steps for the other Naming context.
Reboot the server in normal mode and Perform the following steps for making sysvol as authoritative:
Mark the sysvol as authoritative by changing the msDFSR-Enabled value to 1
>net stop dfsr
>Open Active Directory Users and Computers, go to View and enable Advanced Features
>Navigate to Domain Controllers -> Your DC -> DFSR-Localsettings -> Domain System Volume
>Right-click SYSVOL Subscription, select Properties, and then Attribute Editor
>Find msDFSR-Options, click Edit, change the value to 1, and click OK
>Run repadmin /syncall /Aed from an elevated command prompt to force replication of the AD changes
>Run net start dfsr in an elevated command prompt on the authoritative DC.
>Run dfsrdiag /pollad from an elevated command prompt on the authoritative DC
Verify the domain controller is holding the FSMO roles if not seize the roles. Steps are as follows:
>ntdsutil
>Roles
>Connections
>Connect to Server <Recovered VM>
>quit
>seize PDC Emulator
Repeat the above steps to seize the other Domain specific roles (Infrastructure, RID Master)
Check the time synchronization by using w32tm /query /source.
Verify the DNS Resolution for Root Domain and Child domain from both Root DC and Child DC.
Verify the Parent and child trust using AD Trust console and validate the Trust connection.
Now Domain Controller is completely recovered from backup. Check the health of domain controller using DCDIAG Command.
In case it is planned to move this to Production environment to make these as first root DC and first child DC, then following steps are to be performed to cleanup the stale entries of non-functional DC.
>ntdsutil
>metadata cleanup
>Connections
>Connect to server <server>
>quit
>Select Operation Target
>list domains
>Select Domain <number>
>List Servers in site
>Select Server <number>
>quit
>remove selected server
Confirm for removal as 'Yes'
Repeat the above cleanup steps in both Root Domain DC and Child Domain DC for the non-functioning domain controller.
Verify the Dcdiag, repadmin /showrepl, repadmin /replsummary to check health of Domain controller and replications.
This completes the recovery of both Root Domain and Child Domain.