I decided to tear down my Azure Lab IaaS and ASR infrastructure and rebuild it. The process involves removing the ASR configurations, Recovery Vaults, S2S VPNs, VNets and Azure VM running as a Azure based Domain controller for resilience with on-premise infrastructure and Azure deployed Apps. The next steps will include uninstalling the Domain Controller, delete and disable the VMs and Hyper-V Hosts configured for Azure site Recovery. Following these tasks, I’ll delete or remove the resource group. All resources were configured and created within one ARM Resource Group to make it easier to tear down. The following are steps to uninstall ADDS from the Azure VM using PowerShell:
1) Login to the WS2012 R2 Domain Controller.
2) Open a PowerShell console as Admin.
3) Use the
Get-Command -Module ADDSDeployment cmdlet to review the necessary ADDSDeployment module commands.
5) Create a Credential variable:
6) Create a Local Admin Password secure string:
$adminPassword = ConvertTo-SecureString -String "pa55w04d123A" -AsPlainText -Force
7) Run the ADDS uninstallation cmdlet with the WhatIf parameter to confirm that the script will run successfully:
Uninstall-ADDSDomainController -LocalAdministratorPassword $adminPassword -Credential $cred -DnsDelegationRemovalCredential $cred -RemoveDnsDelegation -WhatIf
8) Run the actual script without the WhatIf parameter:
9) Remove the ADDS role :
Remove-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools -Remove -WhatIf
It might still be necessary to remove refereces to the old DC in DNS and AD Domain Sites.
After disabling protection on the VMs, I deleted the Hyper-V Hosts in the Recovery vault site and then used the following cmdlet to remove the Resource Group:
PS C:\Users\Chinny> Get-AzureRmResourceGroup -Name RGXavier | Remove-AzureRmResourceGroup -Force