Proposed Pull Request Change

title description ms.topic ms.author author ms.date ms.custom
Create and add a VM to a lab Learn how to use the Azure portal to add a virtual machine (VM) to a lab in Azure DevTest Labs. Configure basic settings, artifacts, and advanced settings. how-to rosemalcolm RoseHJM 03/27/2025 ['UpdateFrequency2', 'sfi-image-nochange']
📄 Document Links
GitHub View on GitHub Microsoft Learn View on Microsoft Learn
Content Truncation Detected
The generated rewrite appears to be incomplete.
Original lines: -
Output lines: -
Ratio: -
Raw New Markdown
Generating updated version of doc...
Rendered New Markdown
Generating updated version of doc...
+0 -0
+0 -0
--- title: Create and add a VM to a lab description: Learn how to use the Azure portal to add a virtual machine (VM) to a lab in Azure DevTest Labs. Configure basic settings, artifacts, and advanced settings. ms.topic: how-to ms.author: rosemalcolm author: RoseHJM ms.date: 03/27/2025 ms.custom: - UpdateFrequency2 - sfi-image-nochange #customer intent: As a lab user, I want to learn how to create VMs in DevTest Labs so I can use lab VMs for developing, testing, or training. --- # Create lab VMs in Azure DevTest Labs This article describes how to create Azure virtual machines (VMs) in Azure DevTest Labs by using the Azure portal. You can also create DevTest Labs VMs by using [PowerShell](devtest-lab-vm-powershell.md), [Azure CLI](devtest-lab-vmcli.md), an [ARM template](devtest-lab-use-resource-manager-template.md), or from a [shared image gallery](add-vm-use-shared-image.md). ## Prerequisite - At least [user](devtest-lab-add-devtest-user.md#devtest-labs-user) access to a lab in DevTest Labs. <a name="create-and-add-virtual-machines"></a> ## Configure basic settings 1. In the [Azure portal](https://portal.azure.com), go to the **Overview** page for your lab. 1. On the lab **Overview** page, select **Add**. :::image type="content" source="./media/devtest-lab-add-vm/portal-lab-add-vm.png" alt-text="Screenshot that shows the lab overview page with the Add button."::: 1. On the **Choose a base** page, select an image for the VM. You can choose from Marketplace images, custom images, or formulas that the lab administrator made available. The following instructions use a Windows 11 Pro image. Some bases might have different settings. 1. On the **Basic Settings** tab of the **Create lab resource** screen, provide the following information: - **Virtual machine name**: Keep the autogenerated name, or enter another unique VM name. - **User name**: Keep the user name, or enter another user name to grant administrator privileges on the VM. - **Use a saved secret**: Select this checkbox to use a secret from Azure Key Vault instead of a password to access the VM. If you select this option, under **Secret**, select the secret to use from the dropdown list. For more information, see [Store secrets in a key vault](devtest-lab-store-secrets-in-key-vault.md). - **Password**: If you don't use a secret, enter a VM password between 8 and 123 characters long. - **Save as default password**: Select this checkbox to save the password in the Key Vault associated with the lab. - **Virtual machine size**: Keep the default value for the base, or select **Change Size** to select a different size. For more information about default VM sizes, see [Default VM sizes](#default-vm-sizes). - **Allow hibernation**: Select this option to enable hibernation for the virtual machine. >[!NOTE] >If you enable hibernation, you must also select either **Public IP** or **Private IP** in **Advanced Settings**. Hibernation for **Shared IPs** isn't currently supported. - **OS disk type**: Keep the default value for the base, or select a different option from the dropdown list. - **Security type**: You can select **Trusted launch** to enable trusted launch for Generation 2 VMs. If you select **Trusted launch**, select the **Enable secure boot**, **Enable vTPM**, and **Integrity monitoring** checkboxes as needed. For more information, see [Trusted Launch for Azure virtual machines](/azure/virtual-machines/trusted-launch). - **Artifacts**: Optionally, select **Add or Remove Artifacts** to select and configure artifacts to add to the VM. For instructions, see [Add artifacts](#add-artifacts). :::image type="content" source="./media/devtest-lab-add-vm/portal-lab-vm-basic-settings.png" alt-text="Screenshot that shows the VM Basic Settings page."::: ### Default VM sizes The default **Virtual machine size** that appears in **Basic Settings** depends on the chosen **Image Base** architecture and the lab's **Allowed virtual machine** sizes policy setting. For more information, see [Set allowed virtual machine sizes](devtest-lab-set-lab-policy.md#set-allowed-virtual-machine-sizes). If the lab's **Configuration and policies** > **Allowed virtual machine sizes** policy allows **All sizes**: - For an image base with x64 architecture, the default size is **D4s_v5**. - For an image base with Arm64 architecture, the default size is **D4pls_v5**. If the lab's **Configuration and policies** > **Allowed virtual machine sizes** policy allows only limited **Selected sizes**: - If **D4s_v5** VM size is allowed, the default size is **D4s_v5** for an image base with x64 architecture. - If **D4pls_v5** VM size is allowed, the default size is **D4pls_v5** for an image base with Arm64 architecture. - If **D4s_v5** size isn't allowed for x64 architectures, or **D4pls_v5** size isn't allowed for Arm64 architectures: - If a 4-core nonpremium CPU size is available, the first available 4-core nonpremium CPU size is selected. - If no 4-core nonpremium CPU size is available, the first available 4-core CPU size is selected. - If no 4-core CPU size is available, the first available CPU size is selected. <a name="add-optional-artifacts"></a> <a name="add-artifacts-during-installation"></a> <a name="add-artifacts-after-installation"></a> ## Add artifacts Artifacts are tools, actions, or software you can optionally add to lab VMs. You can add artifacts to VMs from the [DevTest Labs public artifact repository](https://github.com/Azure/azure-devtestlab/tree/master/Artifacts), or from private artifact repositories connected to the lab. For more information about adding artifacts, see [Add artifacts to DevTest Labs VMs](add-artifact-vm.md). You can add artifacts to VMs before or after VM creation. To add artifacts after VM creation, see [Add artifacts to VMs after creation](add-artifact-vm.md#add-artifacts-to-vms-from-the-azure-portal). To add or configure artifacts during VM creation: 1. At the bottom of the **Basic Settings** tab of the **Create lab resource** screen, select **Add or Remove Artifacts**. 1. On the **Add artifacts** page, select the arrow next to each artifact you want to add to the VM. 1. On each **Add artifact** pane, enter any required and optional parameter values, and then select **OK**. The artifact appears under **Selected artifacts**, and the number of configured artifacts updates. :::image type="content" source="./media/devtest-lab-add-vm/portal-add-artifact-during.png" alt-text="Screenshot that shows adding artifacts to a VM."::: 1. When you're done adding artifacts, select **OK** on the **Add artifacts** page. <a name="configure-optional-advanced-settings"></a> ## Configure other settings After you configure basic settings and artifacts, you can optionally configure advanced settings and tags for your VM. 1. Optionally, select **Next: Advanced Settings** or the **Advanced Settings** tab on the **Create lab resource** screen, and change any of the following values: - **Virtual network**: Select a network from the dropdown list. For more information, see [Add a virtual network](devtest-lab-configure-vnet.md). - **Subnet Selector**: If necessary, select a different subnet from the dropdown list. - **IP address**: Leave at **Shared**, or select **Public** or **Private**. For more information, see [Understand shared IP addresses](devtest-lab-shared-ip.md). - **Expiration date**: Leave at **Will not expire**, or [set an expiration date](devtest-lab-use-resource-manager-template.md#set-vm-expiration-date) and time for the VM. - **Make this machine claimable**: Leave at **No** to keep yourself as the owner of the VM. Select **Yes** to make the VM claimable by any lab user after creation. For more information, see [Create and manage claimable VMs](devtest-lab-add-claimable-vm.md). - **Number of instances**: To create more than one VM with this configuration, enter the number of VMs to create. - **View ARM template**: Select this button to view and save the VM configuration as an Azure Resource Manager (ARM) template. You can use the ARM template to [deploy new VMs](/azure/azure-resource-manager/templates/overview). :::image type="content" source="./media/devtest-lab-add-vm/portal-lab-vm-advanced-settings.png" alt-text="Screenshot that shows the VM Advanced Settings page."::: 1. Optionally, select **Next: Tags** or the **Tags** tab to apply tags to the VM. ## Complete VM deployment After you configure all settings, select **Create** at the bottom of the **Create lab resource** screen. During VM deployment, you can select the **Notifications** icon at the top of the screen to see progress. Creating a VM takes a while. When the deployment is complete, if you kept yourself as VM owner, the VM appears under **My virtual machines** on the lab **Overview** page. To connect to the VM, select it from the list, and then select **Connect** on the VM's **Overview** page. Or, if you chose **Make this machine claimable** during VM creation, select **Claimable virtual machines** in the left navigation to see the VM listed on the **Claimable virtual machines** page. Select **Refresh** if the VM doesn't appear. To take ownership of a VM in the claimable list, see [Use a claimable VM](devtest-lab-add-claimable-vm.md#use-a-claimable-vm). :::image type="content" source="./media/devtest-lab-add-vm/portal-lab-vm-creation-status.png" alt-text="Screenshot that shows the lab VM creation status page."::: When you create a VM in DevTest Labs, you automatically have permission to access that VM, and you can see the VM listed both on the lab **Overview** page and the **All resources** page. DevTest Labs users in the **Owner** and **Contributor** roles can see all lab VMs on the lab's **All Resources** page. Users in the **DevTest Labs User** role can't access other users' VM resources by default, so they don't automatically see those VMs on the **All resources** page. ## Copy existing Azure VMs into a lab You can copy existing Azure VMs to DevTest Labs as follows: 1. Use a [PowerShell script](https://github.com/Azure/azure-devtestlab/blob/master/samples/DevTestLabs/Scripts/CopyVirtualMachines/CopyAzVHDFromVMToLab.ps1) to copy your existing VM's virtual hard disk (VHD) file to the lab. 1. Use the VHD file to [create a custom image](devtest-lab-create-template.md) in your lab. 1. [Create a lab VM](add-vm-use-shared-image.md) from your custom image. ## Related content - For information about creating labs, see [Create a lab in the Azure portal](devtest-lab-create-lab.md). - Explore the [artifacts](https://github.com/Azure/azure-devtestlab/tree/master/Artifacts), [environments](https://github.com/Azure/azure-devtestlab/tree/master/Environments), and [QuickStart ARM templates](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/QuickStartTemplates)DevTest Labs public repositories.
Success! Branch created successfully. Create Pull Request on GitHub
Error: