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/deploy-nested-template-environments.md
+7-14Lines changed: 7 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,30 +12,23 @@ ms.date: 04/02/2025
12
12
13
13
# Nested templates in DevTest Labs environments
14
14
15
-
Azure DevTest Labs *environments* consist of multiple infrastructure-as-a-service (IaaS) virtual machines (VMs) with platform-as-a-service (PaaS) resources installed. You can provision DevTest Labs environments by using Azure Resource Manager (ARM) templates.
15
+
An Azure DevTest Labs *environment* consists of multiple infrastructure-as-a-service (IaaS) virtual machines (VMs) with platform-as-a-service (PaaS) resources installed. You can provision and deploy DevTest Labs environments by using Azure Resource Manager (ARM) templates.
16
16
17
-
This article describes using *nested templates* to deploy a DevTest Labs environment. A nested deployment runs secondary ARM templates from within a main template. Using a set of targeted, purpose-specific templates provides testing, reuse, and readability benefits.
17
+
To deploy complex solutions like environments, you can break a template into secondary templates, and deploy these templates through a main template. This article describes using *nested templates* to deploy a DevTest Labs environment. Using a set of targeted, purpose-specific templates to deploy an environment promotes testing, reuse, and readability.
18
18
19
19
For general information about nested templates, including code samples, see [Use linked and nested templates when deploying Azure resources](/azure/azure-resource-manager/templates/linked-templates).
The Azure Resource Group project template in Visual Studio makes it easy to develop and debug nested templates. In DevTest Labs, you can store ARM templates in a Git repository linked to a lab. When you use a repository template to create an environment, DevTest Labs copies the template files into the lab's Azure Storage container.
25
+
In DevTest Labs, you can store ARM templates in a Git repository linked to a lab. When you use repository templates to create an environment, DevTest Labs copies all template and artifact files, including nested template files, into the lab's Azure Storage container.
26
26
27
-
When you add a nested template to a lab repository and main *azuredeploy.json* template file, Visual Studio automatically takes the following actions:
27
+
The main *azuredeploy.json* template file for a nested template deployment uses `Microsoft.Resources/deployments` objects to call linked secondary templates. You provide URI values for the linked templates, and generate a Shared Access Signature (SaS) token for the deployment.
28
28
29
-
- Adds a subfolder for the secondary template and parameters files, and copies the subfolder to the lab storage container.
30
-
- Adds variables for the nested template folder and files to the `variables` section of the main template file.
31
-
- Adds the `_artifactsLocation` and `_artifactsLocationSasToken` parameters to the main template file.
32
-
- Inserts the location and Shared Access Signature (SaS) token into the parameters file.
29
+
The deployment uses Azure PowerShell `New-AzResourceGroupDeployment` or Azure CLI `az deployment group create`, specifying the main template URI and the SaS token. For more information, see [Tutorial: Deploy a linked template](/azure/azure-resource-manager/templates/deployment-tutorial-linked-template).
33
30
34
-
The following screenshot shows the project structure in Visual Studio. The Git repository folder has a subfolder, *nestedtemplates*, that contains the nested template files *NestOne.json* and *NestOne.parameters.json*. You can add more than one nested template subfolder, but at only one level of nesting.
35
-
36
-
:::image type="content" source="media/deploy-nested-template-environments/visual-studio-project-structure.png" alt-text="Screenshot that shows the nested template project structure in Visual Studio.":::
37
-
38
-
## Nested deployment example
31
+
## Nested template example
39
32
40
33
The following example *azuredeploy.json* main template file shows the code for a nested deployment. The main template file defines links to the nested template.
0 commit comments