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-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,26 +10,28 @@ ms.date: 04/02/2025
10
10
#customer intent: As a DevTest labs user, I want to learn about using nested templates to deploy environments so I can take advantage of their testing, reuse, and readability benefits.
11
11
---
12
12
13
-
# DevTest Labs environments with nested templates
13
+
# Nested templates in DevTest Labs environments
14
14
15
-
Azure DevTest Labs environments contain multiple infrastructure-as-a-service (IaaS) virtual machines (VMs) with platform-as-a-service (PaaS) resources installed. You can provision the PaaS and IaaS resources by using Azure Resource Manager (ARM) templates. This article shows an example of nesting templates to deploy an Azure DevTest Labs environment.
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 these PaaS and IaaS resources by using Azure Resource Manager (ARM) templates.
16
16
17
-
A *nested deployment* runs secondary ARM templates from within a main template. Decomposing a deployment into a set of targeted, purpose-specific templates provides testing, reuse, and readability benefits. 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).
17
+
A *nested deployment* runs secondary ARM templates from within a main template. This article shows an example of using nested templates to deploy a DevTest Labs environment.
18
18
19
-
In DevTest Labs, you can store ARM templates in a Git repository that you link to a lab. When you use a linked repository template to create a new DevTest Labs environment, the deployment copies the template files into the lab's Azure Storage container.
19
+
Decomposing a deployment into a set of targeted, purpose-specific templates provides testing, reuse, and readability benefits. 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).
In DevTest Labs, you can store ARM templates in a Git repository that you link to a lab. When you use a linked repository template to create a new DevTest Labs environment, the deployment copies the template files into the lab's Azure Storage container.
26
+
25
27
The Azure Resource Group project template in Visual Studio makes it easy to develop and debug nested templates. When you add a nested template file to the lab repository and add nested template code to the main *azuredeploy.json* template file, Visual Studio automatically takes the following actions:
26
28
27
29
- Adds a subfolder for the secondary template and parameters files, and copies the subfolder to the lab storage container.
28
30
- Adds variables for the nested template folder and files to the `variables` section of the main template file.
29
31
- Adds the `_artifactsLocation` and `_artifactsLocationSasToken` parameters to the main template file.
30
32
- Inserts the location and Shared Access Signature (SaS) token into the parameters file.
31
33
32
-
In the following nested template example, the Git repository folder has a subfolder, *nestedtemplates*, that contains the nested template files *NestOne.json* and *NestOne.parameters.json*. You can add more nested template subfolders, but at only one level of nesting.
34
+
The following nested template example shows a Git repository folder with 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.
33
35
34
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.":::
#customer intent: As a lab administrator, I want to create custom images from VHD files, so I can make the custom images available to lab users as bases for creating lab VMs.
11
11
---
12
12
13
-
# Create a custom image from a VHD file with PowerShell
13
+
# Create a custom image from a VHD file by using Azure PowerShell
Copy file name to clipboardExpand all lines: articles/devtest-labs/devtest-lab-create-custom-image-from-vm-using-portal.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ To create a custom image from a lab VM, take the following steps:
38
38
-**I have already generalized this virtual machine**
39
39
-**Generalize this virtual machine** (for Windows: **(Run sysprep)** or for Linux: **(Run deprovision)**)
40
40
41
-
[Sysprep](/windows-hardware/manufacture/desktop/sysprep--system-preparation--overview) for Windows or [deprovision] for Linux create generalized images that have user profiles and other VM-specific settings removed. If you don't run sysprep or deprovision, the custom image creates exact copies of the machine that can run in isolated networks. For more information, see [Generalize a VM](/azure/virtual-machines/generalize).
41
+
[Sysprep](/windows-hardware/manufacture/desktop/sysprep--system-preparation--overview) for Windows or [deprovision](/azure/virtual-machines/generalize#linux) for Linux create generalized images that have user profiles and other VM-specific settings removed. If you don't run sysprep or deprovision, the custom image creates exact copies of the machine that can run in isolated networks. For more information, see [Generalize a VM](/azure/virtual-machines/generalize).
42
42
43
43
If you want sysprep or deprovision to be run on the VM when creating the custom image, choose **Generalize this virtual machine**. Running sysprep or deprovision when you create the custom image makes the existing VM unusable.
Copy file name to clipboardExpand all lines: articles/devtest-labs/devtest-lab-resize-vm.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Azure DevTest Labs supports changing the size of a lab virtual machine (VM), bas
17
17
18
18
To resize a VM, you must be a lab administrator or an owner of the VM. If the lab sets an [allowed VM sizes](devtest-lab-set-lab-policy.md#set-allowed-virtual-machine-sizes) policy, you can resize the VM only to sizes that the policy permits.
19
19
20
-
The VM must be stopped before you resize it. To stop a VM, disconnect from it, and select **Stop** on the top toolbar of the VM's **Overview** page in the [Azure portal](https://go.microsoft.com/fwlink/p/?LinkID=525040).
20
+
To avoid losing work, stop the VM before you resize it. To stop a VM, disconnect from it, and select **Stop** on the top toolbar of the VM's **Overview** page in the [Azure portal](https://go.microsoft.com/fwlink/p/?LinkID=525040).
21
21
22
22
:::image type="content" source="./media/devtest-lab-resize-vm/stop-vm.png" alt-text="Screenshot that shows selecting Stop on the Overview page for a VM.":::
23
23
@@ -31,7 +31,10 @@ To resize a VM:
31
31
32
32
You can check the status of the resize operation in the **Notifications** window.
33
33
34
-
:::image type="content" source="./media/devtest-lab-resize-vm/resize-status.png" alt-text="Screenshot of the Notifications window that shows resizing status.":::
34
+
:::image type="content" source="./media/devtest-lab-resize-vm/resize-status.png" alt-text="Screenshot of the Notifications window that shows resizing status.":::
35
+
36
+
>[!NOTE]
37
+
>If the resize operation fails with an error that **Resizing virtual machines with shared IP configuration is not supported**, you need to add and associate a Public IP address to the VM. For more information, see [Associate a public IP address to a virtual machine](/azure/virtual-network/ip-services/associate-public-ip-address-vm).
35
38
36
39
When the resize finishes, you can start the VM by selecting **Start** from the VM **Overview** page top toolbar, and then connect to the VM by selecting **Connect** in the toolbar.
Run [terraform init](https://www.terraform.io/docs/commands/init.html) to initialize the Terraform deployment. This command downloads the Azure provider required to manage your Azure resources. The `-upgrade` parameter upgrades the provider plugins to the newest supported version.
Run [terraform plan](https://www.terraform.io/docs/commands/plan.html) to create an execution plan. The `terraform plan` command creates an execution plan, but doesn't execute it. Instead, it determines what actions are necessary to create the configuration specified in your configuration files.
63
+
64
+
This pattern allows you to verify whether the execution plan matches your expectations before making any changes to actual resources. Use the optional `-out` parameter to specify an output file for the plan named `main.tfplan`. You can review the file to ensure that the plan is exactly what to apply.
Run [terraform apply](https://www.terraform.io/docs/commands/apply.html) to apply the execution plan to your cloud infrastructure. The example `terraform apply` command assumes you previously ran `terraform plan -out main.tfplan`.
73
+
74
+
If you specify a different filename for the `-out` parameter in `terraform_plan`, use that filename in the call to `terraform apply`. If you don't use the `-out` parameter in `terraform_plan`, call `terraform apply` without any parameters.
75
+
76
+
```console
77
+
terraform apply main.tfplan
78
+
```
63
79
64
80
## Verify the results
65
81
@@ -73,7 +89,19 @@ az lab vm list --resource-group $resource_group_name --lab-name $lab_name
When you no longer need the resources Terraform created, take the following steps to remove them:
93
+
94
+
1. Run [terraform plan](https://www.terraform.io/docs/commands/plan.html) with the `destroy` flag. The `terraform plan` command creates the execution plan but doesn't execute it. The `-out` parameter specifies an output file for the plan named `main.destroy.tfplan`.
95
+
96
+
```console
97
+
terraform plan -destroy -out main.destroy.tfplan
98
+
```
99
+
100
+
1. Run [terraform apply](https://www.terraform.io/docs/commands/apply.html) to apply the execution plan specified in the `main.destroy.tfplan` file.
0 commit comments