Skip to content

Commit 1d6bbee

Browse files
committed
more edits
1 parent 22794f1 commit 1d6bbee

File tree

1 file changed

+39
-40
lines changed

1 file changed

+39
-40
lines changed

articles/devtest-labs/devtest-lab-use-resource-manager-template.md

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: Create and use ARM templates for VMs
3-
description: Learn how to view, edit, and store Azure Resource Manager (ARM) virtual machine (VM) templates, connect your template repositories to your labs, and access templates to use for creating VMs.
2+
title: Create and manage ARM VM templates
3+
description: Learn how to view, edit, store, and access Azure Resource Manager (ARM) virtual machine (VM) templates, and how lab admins can add template repositories to labs.
44
ms.topic: how-to
55
ms.author: rosemalcolm
66
author: RoseHJM
7-
ms.date: 03/07/2025
7+
ms.date: 03/10/2025
88
ms.custom: UpdateFrequency2
99

10-
#customer intent: As a lab user, I want to know how to create, manage, and access ARM templates, so I can use the templates to create VMs and let other lab users access my templates.
10+
#customer intent: As a lab user, I want to know how to create, manage, and access ARM templates, so I can use the templates to create VMs.
1111
---
1212

13-
# Create and use ARM templates for VMs in DevTest Labs
13+
# Create and manage ARM VM templates in DevTest Labs
1414

1515
This article describes how DevTest Labs users can:
1616

@@ -22,46 +22,40 @@ This article describes how DevTest Labs users can:
2222

2323
ARM templates for VM creation use the [Microsoft.DevTestLab/labs/virtualmachines](/azure/templates/microsoft.devtestlab/2018-09-15/labs/virtualmachines?pivots=deployment-language-arm-template) resource type. Each lab VM created with this resource type appears as a separate item in the lab's **My virtual machines** list.
2424

25-
Lab users can create their own ARM templates, modify existing ARM templates to meet their needs, or access preconfigured templates from their own or others' private repositories or the public [DevTest Labs GitHub repository](https://github.com/Azure/azure-devtestlab).
26-
27-
To create and deploy Azure VMs by using an ARM template, you can use any of the following options:
28-
29-
- [Azure portal](/azure/azure-resource-manager/templates/deploy-portal)
30-
- [Azure CLI](/azure/azure-resource-manager/templates/deploy-cli)
31-
- [PowerShell](/azure/azure-resource-manager/templates/deploy-powershell)
32-
- [REST API](/azure/azure-resource-manager/templates/deploy-rest)
33-
- [Button in GitHub repository](/azure/azure-resource-manager/templates/deploy-to-azure-button)
34-
- [Azure Cloud Shell](/azure/azure-resource-manager/templates/deploy-cloud-shell)
35-
- [Azure Pipelines DevTest Labs Tasks extension](https://marketplace.visualstudio.com/items?itemName=ms-azuredevtestlabs.tasks)
36-
37-
For more information about deployment, see [Template deployment process](/azure/azure-resource-manager/templates/overview#template-deployment-process).
25+
Lab users can create their own ARM templates, modify existing ARM templates to meet their needs, or access preconfigured templates from their own or others' private repositories or the public [DevTest Labs GitHub repository](https://github.com/Azure/azure-devtestlab) to use in creating VMs.
3826

3927
## Prerequisites
4028

41-
- To view or save ARM templates while creating VMs, at least **DevTest Lab User** role in a DevTest Labs lab.
42-
- To enable public repositories or add template repositories to labs, at least **Contributor** role in the lab.
29+
- To view or save ARM templates while creating VMs, at least **DevTest Lab User** role in a lab.
30+
- To enable public repositories or add private template repositories to labs, at least **Contributor** role in the lab.
4331

4432
<a name="view-edit-and-save-arm-templates-for-vms"></a>
4533
## View and save ARM templates for VMs
4634

47-
You can customize and use an ARM template from any available Azure VM base to use for deploying more VMs of the same type.
35+
You can customize and use an ARM template from any available Azure VM base to use for deploying more VMs of the same type. To customize and save an ARM template in the Azure portal:
4836

4937
1. On your lab's **Overview** page, select **Add** on the top toolbar.
5038
1. On the **Choose a base** page, select the VM base you want.
5139
1. On the **Create lab resource** tabs, configure settings and add desired artifacts to your template VM.
5240
1. On the **Advanced Settings** tab, select **View ARM template** under **Automation** at the bottom of the form.
5341
1. Copy and save the contents of the **View Azure Resource Manager template** page as a file named *azuredeploy.json*, and then close the page.
42+
5443
:::image type="content" source="media/devtest-lab-use-arm-template/devtestlab-lab-copy-rm-template.png" alt-text="Screenshot that shows an ARM template to save for later use.":::
55-
1. If you want to create the VM or VMs immediately, select **Create** at the bottom of the **Create lab resource** page.
44+
45+
1. If you want to create the VM immediately, select **Create** at the bottom of the **Create lab resource** page.
46+
47+
For more information on creating lab VMs, see [Create lab virtual machines in Azure DevTest Labs](devtest-lab-add-vm.md).
5648

5749
<a name="set-vm-expiration-date"></a>
5850
## Edit ARM templates for VMs
5951

60-
When you reuse the ARM template to create more VMs, you can edit the values in your template file. To update only the `parameters` section of your template without having to edit the main template file, you can create and edit a separate file called *azuredeploy.parameters.json*.
52+
When you reuse the ARM template to create more VMs, you can edit the `parameters` in your template file. You can create and edit a separate file called *azuredeploy.parameters.json* to update only the parameters without having to edit the main template file.
53+
54+
For example, in training, demo, and trial scenarios, you can automatically delete VMs after a certain date so they don't keep incurring costs. When you create a lab VM in the Azure portal, you specify the **Expiration date** on the **Advanced settings** tab.
6155

62-
For example, in training, demo, and trial scenarios, you can automatically delete VMs after a certain date so they don't keep incurring costs. When you create a lab VM in the Azure portal, you can specify the **Expiration date** on the **Advanced settings** tab. You can also add an `expirationDate` property to the `parameters` section of your template file. For an example, see [Create a new VM in a lab with a specified expiration date](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/QuickStartTemplates/101-dtl-create-vm-username-pwd-customimage-with-expiration).
56+
You can add an `expirationDate` property to your ARM template `parameters` section or file. For an example template, see [Create a new VM in a lab with a specified expiration date](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/QuickStartTemplates/101-dtl-create-vm-username-pwd-customimage-with-expiration).
6357

64-
The following example ARM template `parameters` section includes an `expirationDate` parameter.
58+
The following example `parameters` section includes an `expirationDate` parameter.
6559

6660
```json
6761
"parameters": {
@@ -98,24 +92,15 @@ The following example ARM template `parameters` section includes an `expirationD
9892
>[!TIP]
9993
>To create a URI value for automatically managing *nested templates*, you can add the `_artifactsLocation` and `_artifactsLocationSasToken` parameters to your `parameters` section or file. For more information about nested templates, see [Deploy nested Azure Resource Manager templates for testing environments](deploy-nested-template-environments.md).
10094
101-
### Create multiple VMs at once from the same template
95+
### Create multiple VMs at once
10296

103-
You can specify more than one instance of a template VM to be created at one time. When you create a lab VM in the Azure portal, you can specify **Number of instances** on the **Advanced Settings** tab. To add or change the number of instances in a reusable ARM template, you can edit or add the `copy: count` value in the `resources` section of the template.
104-
105-
The following example ARM template `resources` section specifies creating two VMs.
97+
In the Azure portal, you can create more than one instance of a VM at a time by specifying **Number of instances** on the **Advanced Settings** tab of the VM creation screen. In the ARM template, the `copy` parameter in the `resources` section determines the number of instances to create.
10698

10799
```json
108-
"resources": [
109-
{
110-
"apiVersion": "2018-10-15-preview",
111-
"type": "Microsoft.DevTestLab/labs/virtualmachines",
112-
"name": "[concat(variables('vmName'), padLeft(copyIndex(), 3, '0'))]",
113-
"location": "[resourceGroup().location]",
114100
"copy": {
115101
"name": "[parameters('newVMName')]",
116102
"count": 2
117103
},
118-
...
119104
```
120105

121106
<a name="configure-your-own-template-repositories"></a>
@@ -128,7 +113,7 @@ Use the following file structure to store an ARM template in a source control re
128113

129114
- Name the main template file *azuredeploy.json*.
130115
- Name any standalone parameter customization file *azuredeploy.parameters.json*.
131-
- Optionally, define metadata that specifies the template display name and description in a file named *metadata.json*.
116+
- Optionally, define metadata that specifies the template display name and description in a file named *metadata.json*, as follows:
132117

133118
```json
134119
{
@@ -150,28 +135,42 @@ To see and access the template repositories available to your lab:
150135

151136
The **Public Artifact Repo** and **Public Environment Repo** at the [DevTest Labs public GitHub repository](https://github.com/Azure/azure-devtestlab) are available for all labs. If these repos aren't enabled for your lab, a lab owner or contributor can enable them by selecting the checkboxes next to **Public Artifact Repo** and **Public Environment Repo**, and then selecting **Enable** on the top menu bar. For more information, see [Enable and configure public environments](devtest-lab-create-environment-from-arm.md#configure-public-environment-settings).
152137

153-
If you're a lab owner or contributor, you can add your private ARM template repository to the lab so all lab users can access your templates.
138+
If you're a lab owner or contributor, you can add a private ARM template repository to the lab so all lab users can access the templates.
154139

155140
1. On the **Repositories** page, select **Add** in the top menu bar.
156141

157142
:::image type="content" source="media/devtest-lab-use-arm-template/public-repo.png" alt-text="Screenshot that shows the Repositories configuration screen.":::
158143

159144
1. In the **Repositories** pane, enter the following information:
160145

161-
- **Name**: Enter the repository name to use in the lab.
146+
- **Name**: Enter the repository name.
162147
- **Git clone URL**: Enter the Git HTTPS clone URL from GitHub or Azure Repos.
163148
- **Branch** (optional): Enter the branch that has your ARM template definitions.
164149
- **Personal access token**: Enter the personal access token to securely access your repository.
165150
- To get a token from Azure Repos, at upper right select **User settings** > **Personal access tokens**.
166151
- To get a token from GitHub, under your profile, select **Settings** > **Developer settings** > **Personal access tokens**.
167-
- **Folder paths**: Enter the folder for your ARM template definitions, relative to the Git clone URI.
152+
- **Folder paths**: Enter the folder for the ARM template definitions, relative to the Git clone URI.
168153

169154
1. Select **Save**.
170155

171156
:::image type="content" source="media/devtest-lab-use-arm-template/repo-values.png" alt-text="Screenshot that shows settings for adding a new template repository to a lab.":::
172157

173158
The repository now appears in the **Repositories** list for the lab. Lab users can use the repository templates to [create multi-VM DevTest Labs environments](devtest-lab-create-environment-from-arm.md). Lab administrators can use the templates to [automate lab deployment and management tasks](devtest-lab-use-arm-and-powershell-for-lab-resources.md#arm-template-automation).
174159

160+
## Deploy VMs by using ARM templates
161+
162+
To create and deploy Azure VMs by using ARM templates, you can use any of the following methods:
163+
164+
- [Azure portal](/azure/azure-resource-manager/templates/deploy-portal)
165+
- [Azure CLI](/azure/azure-resource-manager/templates/deploy-cli)
166+
- [PowerShell](/azure/azure-resource-manager/templates/deploy-powershell)
167+
- [REST API](/azure/azure-resource-manager/templates/deploy-rest)
168+
- [Button in GitHub repository](/azure/azure-resource-manager/templates/deploy-to-azure-button)
169+
- [Azure Cloud Shell](/azure/azure-resource-manager/templates/deploy-cloud-shell)
170+
- [Azure Pipelines DevTest Labs Tasks extension](https://marketplace.visualstudio.com/items?itemName=ms-azuredevtestlabs.tasks)
171+
172+
For more information about deployment, see [Template deployment process](/azure/azure-resource-manager/templates/overview#template-deployment-process).
173+
175174
## Related content
176175

177176
- [Best practices for creating ARM templates](/azure/azure-resource-manager/templates/best-practices)

0 commit comments

Comments
 (0)