Automated Test Lab Deployment with Microsoft Azure Automation


If you’re anything like me, you’d rather not spend 2 hours getting together a new lab every time you need a fresh AD domain to do some testing. Often, we end up trying to reuse an existing environment, hoping not to mess anything up. But with automation and cloud infrastructure comes a better way to avoid this pain.

I’ve put together an Azure Automation runbook to automate the deployment of a new VM as a domain controller in a new domain, which can be run with a couple clicks and generates an isolated, ready-to-use lab environment in about 20 minutes. You can then add additional servers into the created virtual network to join to the new domain — one could envision spinning up a quick lab with Operations Manager to do some management pack testing without impacting existing deployments, for example — or really any workload that can exist in Azure virtual machines. If there’s interest I’m considering expanding this to allow deployment of additional components like this.

A little on how it works: given an Azure subscription and an account that has access, the runbook creates a new cloud service and virtual machine along with a new storage account and virtual network. The resource names are generated automatically based upon the specified domain name e.g. “mydomain.local”. Once the Azure resources are created and the VM is provisioned, the runbook connects to the VM remotely via WinRM to the PowerShell endpoint, installs Active Directory and promotes to a new domain controller. It does not yet prepare breakfast.

To view the details and videos showing a demo and installation guide, see this page:

Automated Active Directory Test Domain Deployment in Microsoft Azure

Questions and comments welcome. Enjoy!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.