I’ve written a couple of blog posts in the past about scheduling Azure VMs to turn off at a certain time of day. I use this functionality to ensure I don’t use all of my MSDN credit while carrying out testing on Azure.
Microsoft have recently announced a new solution that will help address this challenge, the solution is called Azure DevTest Labs. You can sign up to the preview of here: https://azure.microsoft.com/campaigns/devtest-lab/ .
Once enrolled in the preview DevTest labs can also be created by searching in the Azure marketplace by searching for “DevTest”:
The focus on Azure DevTest Labs seems to be to provide development teams with an environment that they can easily deploy preexisting VM templates to without the risk of running up high Azure bills. I ran through creating a DevTest Lab and creating a VM, my experiences follow…
Creating a DevTest Lab
When you create your DevTest Lab you are required to enter the following details:
- Lab Name
No spaces allowed
- The credit used by services within your lab will be taken from this subscription.
The Azure region for the DevTest lab – it seems that in preview only certain regions are available.
- Auto Shutdown
Immediately at the point of creating the DevTest lab we able to specify a time of day that all VMs in the lab will be turned off, and hence the compute charges will cease. Given that I often work late I set this to 4am.
Once the DevTest Lab has been created there a number of configurable settings. The first thing to configure is the Policies for the lab. At present there are four options, but only two are currently functional:
- Max VMs per User
One of the key features of a DevTest lab is that multiple user can be granted access to the lab using Role Based Access Control. This policy limits the number of VMs each user can have in the lab.
As specified when the lab was created, if I decide there is never any chance that I will be working until 4am I could come back here and change the time.
The two policies that are currently unavailable are Cost Thresholds and Allowed VM Sizes. I can see the cost threshold feature being very useful especially if multiple users are adding resources to the lab.
Creating VMs from Templates
From my initial investigations it seems that we can only create VMs from Templates that exist within the
lab. It would be useful to be able to add any service from the Marketplace, maybe that will come later. There are a number of templates pre-created when the lab is created. They can be seen below:
New templates can be created from existing VM OS disks that have had SysPrep or uploaded using the PowerShell provided.
Rather than create my own image to save time I created a VM using the Windows Server 2012 R2 Datacenter Template:
One thing to note is it is possible to add artifacts to the VM from a Git repository. I’m reasonably new to Git and will explore this function at a later date!
My first attempt at creating a VM failed. The error was pretty generic:
I dug a but deeper into the logs of the VM that failed creation and found the issues was creating a public IP address. It seems the VM name is also being used to name the public IP. As there is already a public IP on Azure called “testvm.westeurope.cloudapp.azure.com” the VM creation failed.
I retried creating the VM, but used a slightly more complex VM name (added “marcusr” to the end). Success!
You can see from the screenshot above that the VM configuration is automatically generated. A Virtual Network has been created automatically along with IP address configuration, and there was no choice over storage configuration. I’d like to have had a bit more choice.
This is a preview service and hasn’t been around long, it clearly still has a way to go. I can foresee in the future the ability to deploy an Azure Resource Manager JSON template to a DevTest lab, which would definitely give more flexibility.
Having thought about things further, it would have been been easier if I could just add existing (or create new) resource groups into the DevTest lab. That way the virtual machine creation process doesn’t need rewriting inside the lab area of the portal, and this would allow other services to exist in the lab and be controlled by policies such as Cost Thresholds. I look forward to seeing how DevTest labs develops in the future and will definitely be using it to help control my spending when testing on Azure.