You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/devtest-labs/devtest-lab-use-resource-manager-template.md
+24-51Lines changed: 24 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Create and manage ARM VM templates
2
+
title: Create and manage ARM templates for VMs
3
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.
4
4
ms.topic: how-to
5
5
ms.author: rosemalcolm
@@ -10,7 +10,7 @@ ms.custom: UpdateFrequency2
10
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.
11
11
---
12
12
13
-
# Create and manage ARM VM templates in DevTest Labs
13
+
# Create and manage ARM templates for VMs in DevTest Labs
14
14
15
15
This article describes how DevTest Labs users can:
16
16
@@ -22,7 +22,7 @@ This article describes how DevTest Labs users can:
22
22
23
23
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.
24
24
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.
25
+
Lab users can create their own ARM templates, modify existing ARM templates to meet their needs, or access preconfigured templates from private repositories or the public [DevTest Labs GitHub repository](https://github.com/Azure/azure-devtestlab) to use in creating VMs.
26
26
27
27
## Prerequisites
28
28
@@ -49,42 +49,17 @@ For more information on creating lab VMs, see [Create lab virtual machines in Az
49
49
<aname="set-vm-expiration-date"></a>
50
50
## Edit ARM templates for VMs
51
51
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 parameterswithout having to edit the main template file.
52
+
When you reuse the ARM template to create more VMs, you might want to update the parameters and values in your template file. To update only the template `parameters` section without having to edit the main template file, you can create and edit a separate file called *azuredeploy.parameters.json*.
53
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.
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 can specify the **Expiration date** on the **Advanced settings** tab. You can also add an `expirationDate` parameter to an ARM template. 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).
55
55
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).
57
-
58
-
The following example `parameters` section includes an `expirationDate` parameter.
56
+
The following example shows an `expirationDate` parameter.
59
57
60
58
```json
61
59
"parameters": {
62
-
"newVMName": {
63
-
"type": "string",
64
-
"defaultValue": "vm01"
65
-
},
66
-
"labName": {
67
-
"type": "string",
68
-
"defaultValue": "Contoso1"
69
-
},
70
-
"size": {
71
-
"type": "string",
72
-
"defaultValue": "Standard_D2s_v3"
73
-
},
74
-
"userName": {
75
-
"type": "string",
76
-
"defaultValue": "labuser"
77
-
},
78
-
"hibernationEnabled": {
79
-
"type": "bool"
80
-
},
81
60
"expirationDate": {
82
61
"type": "string",
83
62
"defaultValue": "2025-03-15T07:00:00.000Z"
84
-
},
85
-
"password": {
86
-
"type": "securestring",
87
-
"defaultValue": "[[[user/VmPassword]]"
88
63
}
89
64
}
90
65
```
@@ -113,14 +88,7 @@ Use the following file structure to store an ARM template in a source control re
113
88
114
89
- Name the main template file *azuredeploy.json*.
115
90
- Name any standalone parameter customization file *azuredeploy.parameters.json*.
116
-
- Optionally, define metadata that specifies the template display name and description in a file named *metadata.json*, as follows:
117
-
118
-
```json
119
-
{
120
-
"itemDisplayName": "<template name>",
121
-
"description": "<template description>"
122
-
}
123
-
```
91
+
- Optionally, define metadata such as template display name and description in a file named *metadata.json*.
124
92
125
93
The following screenshot shows a typical ARM template folder structure in a repository.
126
94
@@ -130,34 +98,39 @@ The following screenshot shows a typical ARM template folder structure in a repo
130
98
131
99
To see and access the template repositories available to your lab:
132
100
133
-
1. On the lab's **Overview** page, select **Configuration and policies** from the left navigation.
101
+
1. On the lab's **Overview** page in the Azure portal, select **Configuration and policies** from the left navigation.
134
102
1. On the **Configuration and policies** page, select **Repositories** under **External resources** in the left navigation.
135
103
136
104
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).
137
105
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.
106
+
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 its templates.
139
107
140
108
1. On the **Repositories** page, select **Add** in the top menu bar.
141
109
142
110
:::image type="content" source="media/devtest-lab-use-arm-template/public-repo.png" alt-text="Screenshot that shows the Repositories configuration screen.":::
143
111
144
-
1. In the **Repositories** pane, enter the following information:
112
+
1. On the **Repository** screen, enter the following information:
113
+
114
+
-**Name**: Repository name.
115
+
-**Git clone URL**: The Git HTTPS clone URL from GitHub or Azure Repos.
116
+
-**Branch** (optional): The branch that has the ARM template definitions.
117
+
-**Azure Resource Manager template folder path**: The folder path, relative to the Git clone URI, for the ARM template definitions.
145
118
146
-
-**Name**: Enter the repository name.
147
-
-**Git clone URL**: Enter the Git HTTPS clone URL from GitHub or Azure Repos.
148
-
-**Branch** (optional): Enter the branch that has your ARM template definitions.
149
-
-**Personal access token**: Enter the personal access token to securely access your repository.
150
-
- To get a token from Azure Repos, at upper right select **User settings**>**Personal access tokens**.
151
-
- To get a token from GitHub, under your profile, select **Settings**> **Developer settings** >**Personal access tokens**.
152
-
-**Folder paths**: Enter the folder for the ARM template definitions, relative to the Git clone URI.
119
+
1. For **Authentication type**, specify the authentication method to securely access the repository.
- To get a personal access token from GitHub, select your profile and then select **Settings** > **Developer settings** > **Personal access tokens**.
122
+
- To use the GitHub app, you must have the [Microsoft DevCenter GitHub App](https://github.com/apps/microsoft-devcenter) installed. If necessary, select **Sign in with GitHub** and sign in to GitHub.
- To get a personal access token from Azure Repos, select **User settings**at upper right and then select**Personal access tokens**.
125
+
- To use managed identity, add the lab's system-assigned managed identity to the Azure DevOps organization as a user. For more information, see [Add an artifact repo](add-artifact-repository.md?tabs=DevOpsRepoMSI#add-an-artifact-repo).
153
126
154
127
1. Select **Save**.
155
128
156
-
:::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.":::
129
+
:::image type="content" source="media/devtest-lab-use-arm-template/repo-values-gh.png" alt-text="Screenshot that shows settings for adding a new template repository to a lab.":::
157
130
158
131
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).
159
132
160
-
## Deploy VMs by using ARM templates
133
+
## Use ARM templates to deploy VMs
161
134
162
135
To create and deploy Azure VMs by using ARM templates, you can use any of the following methods:
0 commit comments