Uredi

Deli z drugimi prek


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:

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.

Screenshot that shows V Ms in an environment in the 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.

Screenshot that shows the list of single V Ms in the DevTest Labs virtual machines list.

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:

  1. In the Azure portal, search for and select Deploy a custom template.
  2. On the Custom deployment screen, make sure Quickstart template is selected, and select the dropdown arrow next to Quickstart template (disclaimer).
  3. 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.
  4. Select Select template. You can also select Edit template to modify the template.

Screenshot of selecting the template on the Custom deployment page.

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:

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