# How to get started with Azure DevTest Labs

# Reusable lab environments for testing and training

Azure DevTest Labs (opens new window) helps you quickly create environments in Azure while minimizing waste and controlling cost. You can test the latest version of your application by quickly provisioning environments using reusable templates and artifacts like Visual Studio (opens new window) and Node (opens new window), and easily integrate it with your DevOps pipeline (opens new window), or create pre-provisioned environments for training and demos.

In this post, we'll spin up and explore an Azure DevTest Lab (opens new window).

# Prerequisites

If you want to follow along, you'll need the following:

# Create a pool of claimable Virtual Machines (VMs) with all your favorite tools preinstalled

We'll create a small DevTest Lab environment that we can use for software development. Let's start by creating the DevTest Lab resource in Azure:

  1. Go to the Azure portal (opens new window)
  2. Click the Create a resource button (the plus-sign in the top left corner)
  3. Search for DevTest, select the "DevTest Labs" result and click Create
    1. Select a Resource group
    2. Type in a Lab name
    3. Select a Location for the lab
    4. Leave the Public environments setting to On

(Create a DevTest Lab in the Azure portal)

  1. Click Next: Auto-shutdown
  2. Select On for the Enabled setting. This will enable auto-shutdown for all VMs that you create in the lab
  3. Fill in the Scheduled shutdown time
  4. Pick the correct Time zone
  5. Click Review + create and then Create to create the lab

(Configure DevTest Lab default auto-shutdown settings)

When the DevTest Lab is created, navigate to it in the Azure portal. From the overview, we can create an environment of VMs. We'll keep it simple and create single VMs for the lab users to claim. You can also use Azure Resource Manager (ARM) templates (opens new window) to create more complex lab environments, with multiple VMs.

  1. In the overview blade of the DevTest Lab, click Add to start creating a VM
  2. You can now pick a base for your environment. Search for "Visual Studio" and click on one of the results that contains Visual Studio. This creates a VM that has Visual Studio preinstalled on it
  3. In the next blade, configure the settings for the lab resource
    1. Fill in a Name for the VM
    2. Provide a Username
    3. Also fill in a Password, or use a saved secret for the password
    4. Check the Save as default password box
    5. You can leave the Disk and Size for the VM as it is, or change it if you'd like
    6. Leave the OS disk type to the default setting
    7. Click on Add or Remove Artifacts. This is one of the best features of DevTest Labs. In the Add artifacts blade (opens new window), you can pick software that will be preinstalled on all VMs in your lab. There are lots of standard software items that you can choose from the public DevTest Labs Git repository (opens new window). And you can add artifacts from your own Git repository
      1. Search for Notepad++
      2. Click in the arrow next to the result
      3. Select OK to add the artifact
      4. Click OK to go back to the previous blade

(Add artifacts to the VM)

  1. Next, click on the Advanced Settings tab
  2. Set Make this machine claimable to Yes. This will enable lab users to claim the VM, so that they can use it exclusively
  3. Change Number of instances to 3
  4. Go back to the Basic Settings tab
  5. click Create to create the lab with 3 VMs

When the VMs are created, you can find them in the Claimable virtual machines menu of the DevTest Lab resource. Click on one of the VMs to see its details. You'll see that it has the auto-shutdown feature enabled by default.

(Unclaimed VM in Azure DevTest Lab)

  1. Click Claim machine to claim the VM. This means that the VM is now yours to use, until you unclaim it
  2. Navigate to the Create formula menu. Here, you can create a reusable base from this VM, including its artifacts. This is useful when you want to create more VMs based on this one
  3. Next, click on the Artifacts menu. This shows you the artifacts that you configured earlier, and shows when they were installed
  4. Go back to the overview blade of the VM and click Connect. This downloads an RDP file
  5. Open the RDP file and fill in the username and password for the VM
  6. In the VM, search for Notepad++. You'll see that it is preinstalled on the machine

(Notepad++ is a preinstalled artifact on the VM)

# Conclusion

Azure DevTest Labs is great for quickly spinning up customized VM environments that your team can use for development, testing and training. And with intelligent features like auto-shutdown (opens new window), policies (opens new window), and integration with Azure DevOps (opens new window), administrators have control over costs, security and customization. Go and check it out!