Raw New Markdown
Generating updated version of doc...
Rendered New Markdown
Generating updated version of doc...
---
title: Hibernation for virtual machines
description: Learn how to hibernate individual virtual machines (VMs) in Azure DevTest Labs.
ms.topic: how-to
ms.author: rosemalcolm
author: RoseHJM
ms.date: 01/20/2025
ms.custom: UpdateFrequency2
---
# Hibernate VMs in Azure DevTest Labs
As an Azure DevTest Labs lab owner and user, you can Hibernate the virtual machines (VMs) in your lab. Hibernation allows applications and processes that were previously running in your VM resume from the state prior to hibernation. When you hibernate a machine, Azure stores the memory contents of the VM in the OS disk and then deallocates the VM. When the VM is started again from its hibernation state, the memory contents are transferred from the OS disk back into memory. Once a VM is placed in a hibernated state, you aren't charged for the compute cost of the VM, just like how you aren't charged for it in a stopped (deallocated) state. You're only charged for the storage (OS disk, data disks) and networking resources (IPs, etc.) attached to the VM.
> [!IMPORTANT]
> The **Hibernation of VMs** feature is currently in preview in Azure DevTest Labs. For more information about the preview status, see the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/). The document defines legal terms that apply to Azure features that are in beta, in preview, or otherwise not yet released into general availability.
Hibernate is an effective cost management feature for:
- Scenarios where the VMs don't need to run 24/7.
- Scenarios where you donβt want to lose the state of the applications and processes on your VM when it is deallocated.
- Systems with long boot times due to memory intensive applications. These applications can be initialized on VMs and hibernated. These βprewarmedβ VMs can then be quickly started when needed, with the applications already up and running in the desired state.
Azure DevTest Labs currently only supports enabling Hibernation on VM creation. To enable hibernation during VM creation, you can use the Azure portal and API. Hibernation can only be triggered from the API and the Azure portal and not directly from the VM.
> [!NOTE]
> Please note that Hibernation support is limited to certain VM sizes and OS versions. Make sure you have a supported configuration before using hibernation. To learn more about Hibernation in general, its supported configurations in Azure, and other limitations, please visit [Hibernation for Azure Virtual Machines](/azure/virtual-machines/hibernate-resume)
This article explains how to Hibernate VMs in DevTest Labs.
## Create lab virtual machines with Hibernation enabled in Azure DevTest Labs
This article describes how to create Azure virtual machines (VMs) with Hibernation enabled in Azure DevTest Labs by using the Azure portal.
### Prerequisite
You need at least [user](devtest-lab-add-devtest-user.md#devtest-labs-user) access to a lab in DevTest Labs. For more information about creating labs, see [Create a lab in the Azure portal](devtest-lab-create-lab.md).
<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 the 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 of lab overview page showing add button.":::
1. On the **Choose a base** page, select an image for the VM. You can choose Marketplace images, custom images, or formulas that the lab owner made available. The following instructions use Windows 11 Pro. Some bases might have different settings.
1. On the **Basics 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 choose to 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 different sizes.
- **Allow hibernation**: Select this option to enable hibernation for the virtual machine. If you enable Hibernation, you also must select either **Public IP** or **Private IP** in the 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**: Select **Trusted Launch** to enable it for Gen2 VMs. On selecting Trusted Launch When the options Secure boot, vTPM, and Integrity Monitoring appear, select the appropriate options for your deployment. For more information, see [Trusted Launch-enabled security features](/azure/virtual-machines/trusted-launch#secure-boot).
- **Artifacts**: This field shows the number of artifacts already configured for this VM base. Optionally, select **Add or Remove Artifacts** to select and configure artifacts to add to the VM.
:::image type="content" source="./media/devtest-lab-add-vm/portal-lab-vm-basic-settings.png" alt-text="Screenshot showing virtual machine basic settings page.":::
1. After you configure all settings, on the **Basic Settings** tab of the **Create lab resource** screen, select **Create** to deploy the VM with Hibernation enabled.
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. If the VM is stopped, select **Start** first to start the VM.
To learn more about how to create virtual machines (VMs) in Azure DevTest Labs in general, please visit [Create and add virtual machines to a lab in Azure DevTest Labs](devtest-lab-add-vm.md)
## Hibernating a running VM in Azure DevTest Labs
1. Sign in to the [Azure portal](https://portal.azure.com).
1. In the search bar, search for and select **DevTest Labs**.
:::image type="content" source="./media/connect-windows-virtual-machine/search-select.png" alt-text="Screenshot showing search for and select DevTest Labs.":::
1. From the list of labs, select your **lab**.
:::image type="content" source="./media/connect-windows-virtual-machine/select-lab.png" alt-text="Screenshot showing select your lab.":::
1. On the home page for your lab, select the VM from the **My virtual machines** list for which you had enabled Hibernation on VM creation.
:::image type="content" source="./media/connect-windows-virtual-machine/select-windows-vm.png" alt-text="Screenshot showing select your Windows VM.":::
1. On the **Virtual machine** page for your VM, select **Hibernate** on the toolbar. The VM status should be in a running state for Hibernate option to be enabled.
:::image type="content" source="./media/devtest-lab-hibernate/devtest-lab-hibernate-vm.png" alt-text="Screenshot showing select connect on the toolbar.":::
Once you select Hibernate, it will trigger the Hibernation process. Once the Hibernation process is completed, the status will be updated to Hibernated (deallocated).