With the Terraform and PowerShell configuration below you can create a simulated on-premises environment for testing of Azure Site Recovery.
This environment consists of a virtual machine running four Hyper-V guests:
Hostname | IP | Purpose |
---|---|---|
adserver | 192.168.1.10 | A Windows 2019 Server instance running an Active Directory Domain Controller for the contoso.com domain |
fileserver | 192.168.1.11 | A Windows 2016 Server instance running file services |
sqlserver | 192.168.1.12 | A Windows 2019 Server instance running SQL Server 2019 with the AdventureWorks database |
ubuntu | 192.168.1.13 | An Ubuntu 20.04 Server instance |
The lab is based on deploying ASR agents on these machines, creating Recovery Services vault in Azure, and performing ASR failover.
Also included in the configuration are the Azure-native components needed to conduct the disaster recovery. These are:
- Storage account
- Recovery services vault
- Virtual network for test failover (with optional Bastion host)
- Virtual network for real failover (with optional Bastion host)
This lab is designed to be run stand-alone without connectivity to a corporate network. Either public IP addresses or Azure Bastion may be used for access to on-prem and Azure VMs.
- Connect to the Azure Cloud Shell at https://shell.azure.com/ and switch to bash
- Clone the lab repo:
git clone https://github.com/reduards/ASR-LAB.git
cd ASR-LAB
mv terraform.tfvars.sample terraform.tfvars
code terraform.tfvars
- Adjust the terraform variables to suit your requirements. Save and close the file.
- Begin deployment:
terraform init
terraform apply
- Once deployment is complete, log on to the virtual machine via Bastion or its public IP address.
- Start Windows PowerShell and paste the following command:
Invoke-WebRequest https://raw.githubusercontent.com/reduards/ASR-LAB/master/Configure-HyperVHost-Part1.ps1 | Invoke-Expression
- The VM will perform some configuration and reboot.
- After the restart, start PowerShell again and run the final configuration script:
Invoke-WebRequest https://raw.githubusercontent.com/reduards/ASR-LAB/master/Configure-HyperVHost-Part2.ps1 | Invoke-Expression
This script imports the pre-installed Hyper-V guests from a storage account and will take some time.
- Once the script is complete, the environment is ready and Hyper-V manager should show the running VMs.
Windows guest VMs: Administrator / P4ssword!!!!
Ubuntu guest VM: administrator / P4ssword!!!!
SQL administrator: sa / P4ssword!!!!