Microsoft Azure is a Cloud Platform offering various flavors of Services like Platform as a Service (PaaS), Infrastructure as a Service (IaaS) and Software as a Service (SaaS). Many new features are added to the Azure platform on a continuous basis to enable businesses to move their workloads on the cloud and speed up overall development and delivery cycles. Overall for any Cloud application development, creating Infrastructure is the key component. Usually it takes a lot of time, efforts and cost to build a development and testing environment on-premises and maintain it for a longer duration. In this article, we will explore the “DevTest Labs” offering and how it enables businesses to quickly roll the Development and Test environments on Azure with value add features like Cost monitoring, Resource management, Automation and control of the environment.
This article is published from the DNC Magazine for Developers and Architects. Download this magazine from here [Zip PDF] or Subscribe to this magazine for FREE and download all previous and current editions
Introduction to DevTest Labs
Current DevTest Scenario On-Premises
Currently most organizations have their DevTest environments configured On-premises and usually these are complex in nature. We explicitly need to maintain and monitor the infrastructure. We also face downtimes or blockages if there are issues in networks or in physical boxes. We also need to be dependent on our System Admins/IT Admins for the entire DevTest environment setup to run smoothly.
If we try to build a ‘Virtual’ DevTest environment On-premises (Not on Azure or any cloud but using In-House Datacenters), more or less we face the same issues:
1. Delays in environment provisioning
2. Maintenance of the environment (Updates, Patches and overall maintenance)
3. Cost and Efforts to provision and maintain the infrastructure
4. Dependency on IT Administrator/System Administrator and IT Team
Introduction to DevTest Labs in Azure
Azure DevTest Labs offering introduced last year and recently announced as GA (General Availability), solves most of the issues and challenges which businesses face in their actual On-Premises or Virtual Environments (In House Datacenters). In a nutshell, the DevTest Lab is kind of a self-service sandbox environment in Azure.
Setting up the DevTest Labs
Firstly, you need a valid Microsoft Azure subscription. Please note that you can setup and access DevTest Labs from the new Azure Portal (Ibiza) at https://portal.azure.com . You can click on Browse > DevTest Labs as shown below

Once you click on DevTest Labs, it will ask you for five Parameters such as:
1. Lab Name – Any generic name which you / your project wish to keep
2. Subscription – You can choose any subscription if you have multiple ones. Else it will be a default subscription.
3. Location – Nearest Datacenter region where you want to create this environment. You need to choose nearest Datacenter to avoid latency issues
4. Auto-shutdown – This feature allows you to Shutdown your environment at a given specific time based on the selection of a time zone. There is an another “Auto-Start” option as well to turn ON the environment which we will discuss later in this article.
5. Storage – Storage is the backbone of any Azure service whether it is PaaS or IaaS. We need to define storage as all VM’s VHDs will be stored along with other data in Azure storage. Based on your requirement, you can choose either Standard or go for Premium Storage (Premium SSD)

This will now create a structure for your DevTest Lab. After this you need to start adding VMs as per your requirement. Kindly note that by default the deployment model for VMs will be Azure Resource Manager (ARM) and not Classic (Cloud Services). Azure DevTest Labs does not restrict you to create only specific Windows VMs, but it offers a variety of Images in the Gallery including Linux VMs. To a large extent, the VMs which you create from Virtual Machine section, is the same that you can see here.

Creating Virtual Machine in DevTest Labs
You can select any of the Virtual Machine Images from a set of Base images. Note that all these images are provided by Azure and it does not give you the option to choose Custom Images. However, custom images of the Virtual Machines can be prepared in the DevTest Labs, post provisioning. You can see the option for the same as “Create Custom Image (VHD)” under VM > Settings

For VM creation, the steps are very simple and you need to give minimum required information like Username, Password and Size of the VM. Note that it also automatically manages VNET and Subnet for you. You will also get option to Turn ON or OFF the Public IP of the individual VM during the provision.
Adding Artifacts to Virtual Machines in DevTest Labs
One of the common task for all IT Administrators or for that matter Developers too is that we need to install some common set of tools and packages which we use in our day-to-day development along with Visual Studio (you can already get Visual Studio based image in VM Image gallery, so this solves the problem of installing VS on VM). “Artifacts” ease out the overall process for you here. Since by default Azure VMs are connected to internet, it becomes quite easy and seamless to download packages on VM and install them. “Artifacts” section is as big and rich as the VM Gallery and offers a variety of basic and standard packages which you need for your Development and Testing work on the environments. (For example, 7-Zip, Azure PowerShell, Google Chrome etc.) The most amazing part of “Artifacts” is, it changes the list of available packages for you based on your choice of VMs i.e. Windows or Linux. So irrespective of the VM you choose, you still get all the benefits of “Artifacts” as shown here:
For Windows:

For Linux:

If you think that the package you are looking for is not in the list provided by “Artifacts” gallery, then Azure also gives you the flexibility and freedom to associate a package name. For example, you can get package name from the “chocolatey” repository and give/associate the package name here

There are around 4000+ community packages maintained. You can visit them here: https://chocolatey.org/packages
Azure Resource Manager (ARM) Template of individual VM
While provisioning the VM in DevTest Labs, Azure provides you an Azure Resource Manager (ARM) template which you can save and use at any point of time if you wish to provision the VM with same settings and specifications. ARM Template is available across multiple components in Azure which you might be using already.

Finally, after all these setups of VMs you can see the list of all provisioned and available VMs on the dashboard as shown here:

Additional Value-added features of DevTest Labs
Creating Formula (reusable bases)
This is a mechanism to ease and replicate (not fully automated) the VMs in your DevTest Labs. Suppose you are required to create 5 VMs with similar specifications, then “Formula” allows you to save a common set of specifications, which you can save, and can use multiple times for the other four VMs, instead of doing it manually one by one.

You can also “Update” the formula at any point of time as per your requirement. You can notice that the Formula is visible post creation in the VM Gallery, and you can see the same when you start picking up the new base for your new VM from the gallery.

Auto Start and Auto Shutdown of VMs
We have already discussed the Auto Shutdown of VMs which Azure asks us while creating the template for DevTest Labs. You can make changes to the same, post provision as well. The Auto Start option allows you to control your VMs “ON” timings based on your choice of time and time zones for a particular day or the entire week.

This feature was one of the most requested ones for granular control of the environment so that Azure customers can Turn ON and Turn OFF the environment at any point of time. The main reason is to put control on the cost and usage. Previously customers and enterprises were using various mechanisms like Scheduler, Automation Scripts / Automation jobs or some tools based on REST API to Turn ON and OFF VMs. In DevTest Labs, you no longer need these workarounds or additional efforts to perform Auto Start and Shutdown of your VMs, it does out of the box once you configure it as per your need.
Audit Logs
You can see Audit Logs of the entire DevTest Labs components with necessary details along with graphical representation. Like other Audit Logs of various Azure components, you can use them for troubleshooting and getting more information about events. During support tickets or support activity, Audit Logs are always helpful. You can access them from Settings > Audit Logs

You can also Export your Audit logs and archive them in the storage or stream them to Azure Event Hub, but this Export feature is currently in PREVIEW mode.
Virtual Machines per Lab and per User
In order to utilize the environment in an optimized way, creators or administrators of Labs can define the maximum number of Virtual Machines allowed per Lab and maximum number of Virtual Machines allowed per User as well. This allows you to setup a limit on the number of VMs per lab and number of VMs per User.
Resource Management – Tags and Users
As we discussed earlier, the entire deployment strategy for DevTest Labs is Azure Resource Manager (ARM). Hence some of the features which comes with ARM by default, are also available and applicable for DevTest Labs. The Best example is adding Tags in Key-value pair format and providing restricted access to Users or do a user management via Roles (RBAC – Role based Access Control). These features ensure individual responsibility of the DevTest Labs components by Tag and puts restrictions on usage via User management.
Monthly cost trend and Cost by resource
Since it is ARM based and you can have multiple components in the DevTest Labs, hence it allows you to see the per resource consumption. For this you need to go to Settings > Cost by resource.
Monthly cost trend allows you to Manage Target or put some Target on the consumption. This is kind of a projection and is helpful from a better cost and resource consumption point of view.

Those customers or businesses who are currently evaluating Azure and have trail Azure accounts with limited credits will find this feature very useful.
What is the Pricing Model of DevTest Labs in Azure?
Azure DevTest Lab is a FREE Service. The overall pay-as-you-go model charges you for the usage of Azure resources like VM and storage. VM pricing is based on the type and size of VM you choose and standard VM Pricing is applicable. Hence besides this, there are no additional charges to be paid for DevTest Labs. For more pricing related information, you can visit https://azure.microsoft.com/en-in/pricing/details/devtest-lab/
Conclusion
Today’s era is of Rapid Application Development and these applications and services need hosting on a robust, scalable and highly available platform. All businesses and customers have a common requirement of creating DevTest environments for their development or project work for a short span of time, or for a longer duration. Until now, they would spend a lot of time, efforts and resources to create these virtual DevTest environments. However now, Microsoft has addressed this issue by making DevTest Labs service available on Azure. Azure DevTest Labs solves the problem with customization and automation it provides. Now you can create DevTest environments within few minutes even if you don’t have a deep knowledge of automation and complex PowerShell scripts or REST APIs for that matter.
On the other hand, DevTest Labs also allows users to upload a VHD and create a custom image from it (in addition to create one from an existing lab VM). Developers can also author a custom artifact, if none of the artifacts feed their needs [Source: Xiaoying Guo, Azure DevTest Labs, Senior Program Manager].
To keep yourself up to date with the latest information on DevTest Labs, please follow this link https://azure.microsoft.com/en-us/services/devtest-lab/
This article has been editorially reviewed by Suprotim Agarwal.
C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.
We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).
Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.
Click here to Explore the Table of Contents or Download Sample Chapters!
Was this article worth reading? Share it with fellow developers too. Thanks!
Vikram Pendse is currently working as a Cloud Solution Architect from India. He has 13+ years of IT experience spanning a diverse mix of clients and geographies in the Microsoft Technologies Domain. He is an active Microsoft MVP since year 2008. Vikram enables Customers & Communities globally to design, build and deploy Microsoft Azure Cloud and Microsoft AI Solutions. He is a member of many Microsoft Communities and participates as a Speaker in many key Microsoft events like Microsoft Ignite, TechEd, etc. You can follow him on Twitter @VikramPendse and
connect at LinkedIn.