Create Virtual Environments With Azure Lab Services

Introduction

Have you ever wondered how could you create infrastructure needed for your employees, customers, or students to perform their activities? This article demonstrates how Azure Lab Services can create a lab of preconfigured virtual machines for certain use cases that will be discussed at the appropriate time.

This article is part of the Azure Advent Calendar where experts from different communities share their knowledge through their own contributions in different formats, the most common being publications in their own blogs, although they can also be videos, webinars, etc. Read more about it.

Pre-requisites

To use Azure Lab Services you will need an Azure Subscription, you can get one here, or if you are a student you can create one with Azure for students.

Overview

Sometimes, you may want to create specific environments to perform different tasks. Previously, this was handled by creating virtual machines on your own (either on-premises or in the cloud) and installing the software people needed for a certain task. However, this approach has its disadvantages. With the Cloud, managing infrastructure is no longer a “major” concern since the Cloud Service Provider (CSP) can do that for us. Depending on the offer, your responsibilities could be different than the ones you are having with your existing solution.

Microsoft has developed Azure Lab Services which handles almost everything for you, from spinning up Virtual Machines (VMs) to handling errors and scaling infrastructure.

Use cases

First and most common for this cloud service would be Classes and professional teaching. Imagine you are teaching .NET to N number of students. Most likely, you would like to provide N Virtual Machines (one for each student) with NET SDK, NET Runtime and Visual Studio or VSCode installed in every virtual machine and give each student a few hours to complete their homework.

Second one and a cool one, Hackathons and hands-on labs. Sometimes, time is simply not enough in a hackathon. Why don’t you provide the tools that developers probably need to propose solutions for your challenges.

Third, Customer trials and demos. Nowadays software is always released before it is actually finished, to test and integrate feedback. Customers sign up and get access to beta releases or register themselves in a waitlist. This could be a way to demonstrate your prerelease software to specific people.

Lastly, Innovate and experiment. You can test your proof-of-concept ideas.

Azure Lab Services Roles

Azure Lab Services was designed with three roles in mind:

Create Virtual Environments with Azure Lab Services

Figure 1

Despite the name of the roles, as mentioned in the previous section, the service can be used for other scenarios different than classrooms. The idea behind the names is to explain in a simpler way.

IT Admin: Creates a lab plan using the Azure Portal or Azure CLI and provides the access to the educators.

Educator: Configures lab virtual machines with the right content and invites students to join the classroom.

Student: Uses the pre-configured virtual machine with immediate access to the content.

Figure 2 shows a diagram of Azure Lab Services workflow.

Create Virtual Environments with Azure Lab Services

Figure 2

Case scenario

Let us recapitulate the .NET example from the use cases. You have N students.

Let us say there are 4 students (represented in Figure 3), each one of them will need a computer with a minimum of hardware requirements to run the software.

Create Virtual Environments with Azure Lab Services

Figure 3

As shown in Figure 4. Jane Doe and John Smith did not meet the requirements to run the tools for the class (either by a hardware or a software issue)

Create Virtual Environments with Azure Lab Services

Figure 4

A possible solution would be to buy new hardware (as shown in Figure 5), however, the expenditure would be high, and nothing warranty the new equipment will work for the desired task.

Create Virtual Environments with Azure Lab Services

Figure 5

Another solution would be to run a Virtual Machine (either local or in the cloud, Figure 6) but as mentioned in the Overview section this solution can be hard to manage on your own.

Create Virtual Environments with Azure Lab Services

Figure 6

Therefore, using Azure Lab Services would be a great fit for this situation, and despite John Doe and Judy Doe machines were working perfectly, anyway they are connected to save student’s time configuring the environment as represented in Figure 7.

Create Virtual Environments with Azure Lab Services

Figure 7

Let us imagine that the Educator decides that the Operating System will be Windows 11. In Azure Lab Services the Educator turns on the template VM and connects through RDP (Figure 8). Then, the Educator customizes the VM installing NET SDK, NET Runtime and VSCode.

Create Virtual Environments with Azure Lab Services

Figure 8

Later, the Educator invites all users through an email with a registration link to join the lab and they are assigned to a VM automatically when they have accepted the invitation.

Create Virtual Environments with Azure Lab Services

Figure 9

The students will be able to use the VM during a scheduled event (the period of time during which the class takes place) and some additional time for homework. Take a look at Figure 9. Judy Doe has already used 0.2 hours outside of a scheduled event (the class) to do the homework.

When the Student turns on his/her VM, VSCode, NET SDK and NET Runtime will be already installed since the Educator downloaded them in the template VM.

VM desktop with VSCode

Figure 10

Therefore all Students were able to take the .NET class without any hardware or software issue. In addition, the educator saved their time by installing everything they need for the class.

Summary

To deal with infrastructure management while having identical environments across multiple VMs, Microsoft has created a service called Azure Lab Services that allows to create, manage, provide and destroy virtual environments easy and fast. It can be used in different scenarios, such as classes and professional teaching, hackathons and hands-on labs, customer trials and demos, proofs of concept ideas, etc.

In the next article, a step-by-step guide to use Azure Lab Services will be introduced with an example from the discussed use cases.

Article Resources

  • Icons Courtesy by https://icons8.com