Azure Resource Manager (ARM) templates in Azure DevTest Labs
Azure DevTest Labs can use Azure Resource Manager (ARM) templates for many tasks, from creating and provisioning labs and virtual machines (VMs) to adding users.
An Azure Resource Manager template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. The template uses declarative syntax. You describe your intended deployment without writing the sequence of programming commands to create the deployment.
In DevTest Labs, you can:
Use an ARM quickstart template to deploy a lab with a virtual machine (VM).
Create your own ARM templates to use for various tasks. Follow the steps at Create and deploy ARM templates, and modify the example templates for your needs.
Access the public DevTest Labs GitHub repository for preconfigured ARM templates and scripts that you can use as-is or customize.
Connect public and private template repositories to DevTest Labs, so lab users can use the templates to create and manage their own resources and environments.
Use an ARM template from any available Azure VM base image to create more VMs or custom images.
Use ARM environment templates to create multi-VM infrastructure-as-a-service (IaaS) or platform-as-a-service (PaaS) DevTest Labs environments.
Use ARM templates with Azure PowerShell or Azure CLI automation to create, deploy, and manage labs, environments, and VMs.
Single-VM and environment templates
DevTest Labs often uses ARM templates to create VMs. There are two methods for creating VMs in DevTest Labs. Each method is used for different scenarios and requires different permissions. The ARM template's resource
property declares the method to use.
Microsoft.Compute/virtualmachines environment templates
ARM templates that use the Microsoft.Compute/virtualmachines resource type provision multiple lab VMs and PaaS resources in a single environment, such as a SharePoint farm. Lab users can use these templates to create multiple-VM environments. VMs created with this resource type appear under the environments in the lab's My environments list.
For more information and instructions for configuring and using environment templates, see Use ARM templates to create DevTest Labs environments.
Microsoft.DevTestLab/labs/virtualmachines single-VM templates
ARM templates that use the Microsoft.DevTestLab/labs/virtualmachines resource type provision individual VM configurations. Each VM created with this resource type appears as a separate item in the lab's My virtual machines list. To create and deploy VMs with these templates, you can use a quickstart template from the Azure portal. You can also automate VM deployment with Azure PowerShell or Azure CLI.
ARM quickstart templates
To use an ARM template to quickly create a DevTest Labs lab with a Windows Server VM, follow the instructions at Quickstart: Use an ARM template to create a lab in DevTest Labs.
Or to access DevTest Labs quickstart template from the Azure portal:
- In the Azure portal, search for and select Deploy a custom template.
- On the Custom deployment screen, make sure Quickstart template is selected, and select the dropdown arrow next to Quickstart template (disclaimer).
- Type devtest in the filter box, and then select the dtl-create-lab-windows-vm-claimed template or other quickstart template from the popup list.
- Select Select template. You can also select Edit template to modify the template.
ARM template automation
Lab administrators can deploy ARM templates with Azure CLI or Azure PowerShell to automate VM creation and management.
In Azure CLI, use the commands az lab vm create and az deployment group create to automate VM creation with ARM templates. For more information and instructions, see Deploy resources with Resource Manager templates and Azure CLI.
In Azure PowerShell, use New-AzResource and New-AzResourceGroupDeployment to provision VMs with ARM templates.
Note
We recommend that you use the Azure Az PowerShell module to interact with Azure. To get started, see Install Azure PowerShell. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.
Lab administrators can deploy ARM templates to create claimable lab VMs or image factory golden images. Provisioning VMs with PowerShell requires administrator permissions. Lab users can then use the custom images to create VM instances. For more information and instructions, see Create a DevTest Labs VM with Azure PowerShell.
You can automate several other common DevTest Labs tasks by using ARM templates with PowerShell:
- Create a custom image from a VHD file using PowerShell
- Upload a VHD file to a lab's storage account using PowerShell
- Add an external user to a lab using PowerShell
- Create a lab custom role using PowerShell
Lab administrators can also automate ARM environment template deployment, to fully manage development and test environments. For information and instructions, see Automate environment creation.
Next steps
- Best practices for creating Azure Resource Manager templates has guidelines and suggestions for creating reliable, easy-to-use ARM templates.
- Deploy resources with Resource Manager templates and Azure PowerShell has general information about using Azure PowerShell with ARM templates.
- The public DevTest Labs GitHub repository has preconfigured quickstart ARM templates, PowerShell scripts, artifacts, and environments that you can use as-is or customize for your needs.
- You can explore more ARM templates in the Azure Quickstart template gallery.