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
+34-22Lines changed: 34 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ author: RoseHJM
7
7
ms.date: 03/10/2025
8
8
ms.custom: UpdateFrequency2
9
9
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.
10
+
#customer intent: As a lab user, I want to know how to create, manage, and access ARM templates for creating Azure VMs, so I can use the templates to create more VMs.
11
11
---
12
12
13
13
# Create and manage ARM templates for VMs in DevTest Labs
@@ -16,7 +16,7 @@ This article describes how DevTest Labs users can:
16
16
17
17
- View, edit, and save Azure Resource Manager (ARM) templates for creating Azure VMs.
18
18
- Store the ARM templates in source control repositories.
19
-
-Connect the ARM template repositories to Azure DevTest Labs so other lab users can access the templates.
19
+
-Access the ARM template repositories in Azure DevTest Labs to use the templates.
@@ -49,11 +49,9 @@ 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 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*.
52
+
When you reuse the ARM template to create more VMs, you can 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 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
-
56
-
The following example shows an `expirationDate` parameter.
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 or change the value in an ARM template.
57
55
58
56
```json
59
57
"parameters": {
@@ -64,12 +62,14 @@ The following example shows an `expirationDate` parameter.
64
62
}
65
63
```
66
64
65
+
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).
66
+
67
67
>[!TIP]
68
68
>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).
69
69
70
70
### Create multiple VMs at once
71
71
72
-
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.
72
+
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 an ARM template, you can add or edit the `copy` parameter in the `resources` section to specify the number of instances to create.
73
73
74
74
```json
75
75
"copy": {
@@ -94,39 +94,51 @@ The following screenshot shows a typical ARM template folder structure in a repo
94
94
95
95
:::image type="content" source="media/devtest-lab-use-arm-template/repo-structure.png" alt-text="Screenshot that shows key ARM template files in a repository.":::
96
96
97
-
## Add template repositories to labs
97
+
## Access template repositories for labs
98
98
99
99
To see and access the template repositories available to your lab:
100
100
101
101
1. On the lab's **Overview** page in the Azure portal, select **Configuration and policies** from the left navigation.
102
102
1. On the **Configuration and policies** page, select **Repositories** under **External resources** in the left navigation.
103
+
1. Copy the **Git Clone URL**s and connect to the repos to access the templates.
104
+
105
+
:::image type="content" source="media/devtest-lab-use-arm-template/public-repo.png" alt-text="Screenshot that shows the Repositories configuration screen." lightbox="media/devtest-lab-use-arm-template/public-repo.png":::
103
106
104
107
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).
105
108
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.
109
+
## Add template repositories to labs
107
110
108
-
1. On the **Repositories** page, select **Add** in the top menu bar.
111
+
Lab owners or contributors can add ARM template repositories to their labs so all lab users can access the templates. To add a repo, select **Add** in the top menu bar of the **Repositories** page.
109
112
110
-
:::image type="content" source="media/devtest-lab-use-arm-template/public-repo.png" alt-text="Screenshot that shows the Repositories configuration screen.":::
113
+
# [GitHub repo](#tab/GitHubRepo/)
111
114
112
115
1. On the **Repository** screen, enter the following information:
113
-
114
116
-**Name**: Repository name.
115
-
-**Git clone URL**: The Git HTTPS clone URL from GitHub or Azure Repos.
117
+
-**Git clone URL**: The Git HTTPS clone URL from GitHub.
116
118
-**Branch** (optional): The branch that has the ARM template definitions.
117
119
-**Azure Resource Manager template folder path**: The folder path, relative to the Git clone URI, for the ARM template definitions.
120
+
-**Authentication type**: The authentication method to securely access the repository, **Personal access token** or **GitHub App**.
121
+
- To get a personal access token, select your profile in GitHub and then select **Settings** > **Developer settings** > **Personal access tokens**.
122
+
- To use the GitHub app, select **Sign in with GitHub** and sign in if necessary. You must have the [Microsoft DevCenter GitHub App](https://github.com/apps/microsoft-devcenter) installed.
123
+
1. Select **Save**.
118
124
119
-
1. For **Authentication type**, specify the authentication method to securely access the repository.
120
-
- For GitHub repos, select **Personal access token** or **GitHub App** authentication.
121
-
- 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.
123
-
- For Azure Repos repos, select **Personal access token** or **Managed Identity** authentication.
124
-
- 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).
125
+
:::image type="content" source="media/devtest-lab-use-arm-template/repo-values-gh.png" alt-text="Screenshot that shows GitHub settings for adding a new template repository to a lab.":::
126
126
127
+
# [Azure Repos repo](#tab/DevOpsRepo/)
128
+
129
+
1. On the **Repository** screen, enter the following information:
130
+
-**Name**: Repository name.
131
+
-**Git clone URL**: The Git HTTPS clone URL from Azure Repos.
132
+
-**Branch** (optional): The branch that has the ARM template definitions.
133
+
-**Azure Resource Manager template folder path**: The folder path, relative to the Git clone URI, for the ARM template definitions.
134
+
-**Authentication type**: The authentication method to securely access the repository, **Personal access token** or **Managed Identity**.
135
+
- To get a personal access token, select **User settings** at upper right in Azure DevOps and then select **Personal access tokens**.
136
+
- 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).
127
137
1. Select **Save**.
128
138
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.":::
139
+
:::image type="content" source="media/devtest-lab-use-arm-template/repo-values.png" alt-text="Screenshot that shows Azure Repos settings for adding a new template repository to a lab.":::
140
+
141
+
---
130
142
131
143
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).
132
144
@@ -149,4 +161,4 @@ For more information about deployment, see [Template deployment process](/azure/
149
161
-[Best practices for creating ARM templates](/azure/azure-resource-manager/templates/best-practices)
150
162
-[Add a Git repository to store custom artifacts and ARM templates](devtest-lab-add-artifact-repo.md)
151
163
-[Use ARM templates to create DevTest Labs environments](devtest-lab-create-environment-from-arm.md)
152
-
-[ARM quickstart templates for DevTest Labs automation](https://github.com/Azure/azure-quickstart-templates)
164
+
-[Quickstart ARM templates for DevTest Labs automation](https://github.com/Azure/azure-quickstart-templates)
0 commit comments