Skip main navigation

Provisioning Environments with Azure DevTest Labs

In this article, we’ll explore the key features of DevTest Labs and how DevTest Labs promotes scalability.

Up to this point in the DevOps Development Process Implementation course, you’ve learned that Azure offers automation solutions that can help you streamline your development and deployment processes.

By now, you can create and run templates in Azure instead of writing endless code and scripts. But what if you want to scale your development? In this article, we’ll explore the key features of DevTest Labs and how DevTest Labs promotes scalability.

What is DevTest Labs?

Although it’s always been easy to spin up virtual infrastructure in the cloud, to realise the benefits at scale, consumers need development and test labs that lend themselves to reuse, standard and secure setup, enterprise policies and proactive cost tracking. Azure DevTest Labs is an Azure service that addresses and accomplishes these goals.

DevTest Labs expedites the configuration of self-service Azure environments by allowing developers and testers to quickly provision Windows and Linux environments in Azure by using reusable templates and artefacts.

DevTest Labs is also capable of inheriting Azure marketplace images. The marketplace has a large collection of open-source product images that can be used to quickly provision infrastructure in the lab.

The automation assets and components created within the Azure DevTest Labs can be invoked by using out-of-the-box integration between Azure and Visual Studio Team Services (VSTS). Deployment pipelines within VSTS can be used to provision dev and test machines in the lab on Azure. The newly provisioned machines automatically inherit the permissions and the lab policies, such as shut-down and start-up routines.

You can create pre-provisioned environments by claiming the environment of the last good build of an application and using it immediately. Source control can be used to manage and share captured environment templates and artefacts. The API or preexisting plugins can be used to provision the environments directly from a preferred continuous integration tool or automated release pipeline.

Provisioning a New Lab

To create a new lab in Azure DevTest Labs:

  1. Go the portal.
  2. Select More services > DevTest Labs.
  3. On the DevTest Labs blade, select Add.
  4. On the Create a DevTest Lab blade, fill in the parameters and select Create:

PROVISION LAB GRAPHIC

The following resources are created when you provision a DevTest Lab:

  • Storage accounts are provisioned
  • The network is created
  • The lab is created
  • A Key Vault or Secret Vault is created.

Key Features

Key/Secret Vault

You’re often asked to enter a complex secret when using Azure DevTest Labs: The password for your Windows VM, a public SSH key for your Linux VM, or a personal access token to clone your Git repo through an artefact. Secrets are usually long and have random characters, so it can be difficult to ensure accuracy.

DevTest Labs provides a personal secret store for each lab user to keep your secrets safe. In the store, you can save your secret into the key vault with a name that DevTest Labs creates for you and use it later.

In the DevTest Labs portal, when a secret is needed to create a VM or to use an artefact, in addition to an input box asking for the secret, you’ll see a checkbox where you can select to use the secrets from the secret store. After a secret is selected, the input box will turn into a drop-down list where you can simply pick a secret:

SECRET VAULT 01 GRAPHIC

To save your secret into your secret store, go to My secret store and enter a name and your secret as the value:

SECRET VAULT 02 GRAPHIC

In addition to creating VMs and using artefacts, you can save your secret name with formulas and Azure Resource Manager templates. Here’s an example of how it’s used in a Resource Manager template to provision a new lab VM:

SECRET VAULT 03 GRAPHIC

Cost Tracking

Your DevTest lab allows you to see how much you’ve spent in your lab and it gives you a projection of your current trend of spending. Apart from just seeing the cost, you have the option to manage your target cost as well.

You can schedule your tracking and set target thresholds for how much you want to spend. When your cost reaches the threshold, you can have certain actions performed within your lab such as notifications and displaying charts with trendlines. You also have the option of using a webhook URL. When the threshold is reached, you can trigger an action behind the scenes to call a webhook or a logic app, which does some downward workflow processing within your organisation.

Lab Policies

Azure DevTest Labs allows you to select policies to control cost and minimise waste in labs.

LAB POLICIES GRAPHIC

Allowed VM Sizes

The policy for setting the allowed virtual machine (VM) sizes helps to minimise lab waste by enabling you to specify which VM sizes are allowed in the lab. If this policy is activated, only VM sizes from this list can be used to create VMs.

VMs Per User

This policy allows you to specify the maximum number of VMs that can be created by an individual user. If a user attempts to create a VM when the user limit has been met, an error message indicates that the VM cannot be created.

VMs Per Lab

This policy allows you to specify the maximum number of VMs that can be created for the current lab. If a user attempts to create a VM when the lab limit has been reached, an error message indicates that the VM cannot be created.

Auto-Shutdown

This policy helps to minimise lab waste by allowing you to specify the time that the lab’s VMs shut down.

Auto-Start

This policy allows you to specify when the VMs in the current lab should be started.

External Resources Repository

With the external resources repository, you can share artefacts within your labs such as sharing automation scripts across all VMs in your lab or bootstrapping machines that are being provisioned.

Marketplace

You can create a marketplace where you can share your DevTest lab. Consumers can consume all your marketplace images and custom images.

Formulas

A formula is essentially a recipe of how your machines must be provisioned.

Role-Based Access

RBAC allows you to control who has permission to create VMs and artefacts within your lab, and who simply consumes the VMs and artefacts that were created.

Claimable VMs

You have the opportunity to set up claimable VMs for consumers in your environment to see which VMs are available for use.

This article is from the free online

Microsoft Future Ready: DevOps Development, Implementation and Azure Automation

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now