Click here to Skip to main content
15,886,799 members
Articles / Hosted Services / Azure

Azure Dev/Test Labs for Your Next Team Environment?

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
2 Mar 2016CPOL8 min read 6.6K  
This article will run you through the features of the new free preview offering from Microsoft called Azure DevTest Labs.

This article is an entry in our Microsoft Azure IoT Contest. Articles in this section are not required to be full articles so care should be taken when voting.

Originally posted on http://geekswithblogs.net/PaulNichols/archive/2016/03/03/azure-devtest-labs-for-your-next-team-environment.aspx.

Introduction

This article will run you through the features of the new free preview offering from Microsoft called Azure DevTest Labs.

Azure DevTest Labs gives developers on-demand, self-service, Azure-based test environments. Developers and testers can quickly create environments and resources in Azure while minimizing waste and controlling cost.

Also, create pre-provisioned environments for training and demonstrations.
Azure Resource Manager allows you to script the deployment of the whole environment which means it could be kicked off from your CI pipeline. Reusable templates can be the basis of your VMs (they can be either out of the box or created from your own VMs). Further customization can be achieved through either, what's called, artefacts or Configuration Management tools that kick in after provisioning a base VM. Examples of these tools would be Puppet, Chef or Desired State Configuration (DSC).

I’ve split this topic into two parts, the next article will go into detail on how to configure your machines using DSC & Chocolatey. But first, let’s take a look around Dev/Test labs and how to script the creation of resources.

What Does DevTest Labs Have to Offer

So if we go to the Azure Portal and select new resource, then search for DevTest, we’ll see the offering to select and create. We’re then presented with this blade where we get to enter a name for the lab, choose a location, storage type and if we’d like the lab to be automatically shut down out of hours (a great way to save a heap of money).

clip_image002[4]

Once created, if you open the new lab and select the “All Settings” link, you’ll be presented with a properties blade to allow you to configure the lab (not all options are implemented at the time of writing this article). Let's go through each section…

clip_image004[4]

Audit Logs

Full audit of any actions carried out by the users of the lab such as creating VMs or deleting resources.

VMs

This option allows you to get to each of the VMs in the lab and manage these in the normal way you would any VM outside of DevTest labs, such as start/stop, connect or resize.

Artefact Repository

This is where you add new, or manage current, repositories of artefacts. Artefact repositories, such as the GitHub repository that comes as standard, contain a list of tools and extensions that can be installed on the VMs after they have been provisioned such as Powershell, DSC or Chocolatey. We’ll talk more about this later as we create an environment and then I’ll show you some alternative ways to configure your machines.

VM Bases

Again, this is an interesting area of the offering. Here, you can set up templates which can be selected by the team to allow them to quickly provision a new machine. DevTest Labs comes with a number of base VMs templates to choose from such as Windows Server, Windows Server with Visual Studio installed or a Linux distribution. It is also possible to create a new template based on an image you already have in Azure (perhaps you created a VM from a gallery image and then customized it somehow). Also you can create a template straight from a Azure gallery VM by going into the Azure Marketplace option and selecting “Yes” I would like to use the whole gallery as templates.

We’ll go into this in a bit more detail later and I’ll show you how to easily create the template variations using Azure Resource Manager templates.

Policies

Ok, so I haven’t shown you much yet that distinguishes this offering from just creating a network of VMs in Azure (except having a nice set of templates to choose from). Policies is what they have added that really helps in a team environment. Devs love to go wild and spin up all sorts of resources :). In Azure, it is easy to do this without giving a great deal of thought to the cost.

With policies, we are able to add some control around:

  • Expenditure per month
  • Number of VMs per user
  • Size of the VMs
  • Total VMs
  • Auto shut down/start up

Users

And finally, you are able to control which users can access the Lab and the level of control they have (roles).

Let's Create An Environment

Enough talking. Let's create a lab!

I’m going to walk you through creating a lab containing two VMs (of course, it is possible to include PaaS resources as well as IaaS):

  1. A BizTalk VM (inc. VS 2013 ). This will be created from an Azure gallery image, then (just for the sake of the demonstration) I will customize it with notepad++, then I'll make that VM into a custom template for other members of the team to select.
  2. A Development VM based on the standard VS 2015 template that comes with DevTest Labs

If you select the resource group the lab lives in, you’ll see we already have storage accounts created for us and a network for the VMs to communicate through (which is pretty awesome).

image

Next, click on the Add VMs button, you’ll see this blade and you’ll be able to add the development VM by choosing the VS2015 template from the Base option. Any user with permissions to the lab will be able to perform this option, templates makes creating a VM a self service function any user can perform.
What’s interesting about the VM size option is that only the sizes allowed by the policies will be shown so users can’t go mad and provision whatever they fancy.

clip_image010_4

Artefacts

So artefacts are software that you can have automatically installed on your VM after it’s provisioned. Also, you might not want to install software but instead drop your latest build from your CI pipeline and deploy that, maybe you’ve stood this VM up just to test your build on.

In order to follow the next article on DSC, you might want to select Powershell to be installed. It’s possible to install artefacts at any stage, just right click on a DevTest VM and select an artefact to be installed.

It’s possible to create your own artefacts this article explains how.

clip_image012[4]

Finally, choose your resource location and then you can preview the ARM template Azure will use to deploy your resource when you click Create. We’ll keep that template to one side as later on we’ll put all the templates together and make one uber template that can spin up the whole environment.

So we’ve created a VM from a standard template (we could also have selected an image from the Azure gallery). Next, let's pretend we’ve customized that VM with some configured software. What we’d like to do then is to convert that VM into a template for others to use.

To do this, I refer you to the Azure Resource Manager GitHub repository where you will find a number of deployment files such as this one which will take a VM and convert it into a template.

The big “Deploy to Azure” button sadly doesn’t work as the file has moved branches. It’s probably just as easy to copy the template text and then start your own ARM template deployment in the Azure portal.

To do that, click here.

Then, in the blade, click the “Edit Template” option, paste the ARM template from GitHub into that blade and save.

Choose your subscription and resource group (the one you have your lab in) and agree to the legal terms. The final part is to populate the parameters.

image

The existing lab name is the name you gave to your lab.

The template name is what you’d like this template to be named when others see it in the list of templates to select, and if that isn’t meaningful enough, give the template a description too.

Finding the existing VM resource Id is a bit harder. The way I found it was through the website https://resources.azure.com and searched by VM name. It will be something like: "/subscriptions/{subscription id}/resourceGroups/{resource group name}/providers/Microsoft.Compute/virtualMachines/{name of vm to template}".

Clicking create should then create the template in your lab and be available to pick when you choose the base template for your new lab VMs.

Putting It All Together

So far, I've shown you how to create labs, templates and VMs through the portal UI but as we’ve seen along the way, it’s all driven by ARM templates. It’s of course possible to combine all the templates into one template and create your environment in one step.

If you check my Gist, then you’ll see the sort of script you’ll need.

If you run this json file using the custom deployment method mentioned before then (fingers crossed) and the environment will be created for you automagically.

Summary

So we’ve talked about the DevTest Labs offering and how it can help your development team by providing a consistent way to spin up new environments per project.

With scripting, it also becomes possible to incorporate labs into your CI pipeline.

Next time, we’ll talk about customization of your VMs and using DSC/Chocolatley as an alternative to artefacts.

Resources

Technorati Tags: azure,dtl,dsc

Image 7

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Mexia
Australia Australia
I'm a Senior Consultant and for almost 20 years I've utilised Microsoft technologies and tools to deliver solutions for many companies both in the UK and Australia and within sectors such as Financial Services, Education and Government.
I specialise in Enterprise Integration through BizTalk, Azure & .Net and deliver outcomes using agile methodologies.
Much of my earlier career was spent as a .Net consultant due to an early adoption & knowledge of the framework in 2001.

Comments and Discussions

 
-- There are no messages in this forum --