Configure hibernation in Microsoft Dev Box
In this article, you learn how to enable and disable hibernation in Microsoft Dev Box. You control hibernation at the dev box image and dev box definition level.
Hibernating dev boxes at the end of the workday can help you save a substantial portion of your virtual machine (VM) costs. It eliminates the need for developers to shut down their dev box and lose their open windows and applications.
With the introduction of Dev Box Hibernation (Preview), you can enable this capability on new dev boxes and hibernate and resume them. This feature provides a convenient way to manage your dev boxes while maintaining your work environment.
There are three steps to enable hibernation:
- Enable hibernation on your dev box image
- Enable hibernation on your dev box definition
- Automate hibernation of pools of dev boxes using auto-stop schedules, or stop on RDP disconnect.
Important
Dev Box Hibernation is currently in PREVIEW. For more information about the preview status, see the Supplemental Terms of Use for Microsoft Azure Previews. The document defines legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
Considerations for hibernation-enabled images
Before you enable hibernation on your dev box, review the following considerations for hibernation-enabled images.
Currently, two SKUs support hibernation: 8 and 16 vCPU SKUs. Currently, 32 vCPU SKUs don't support hibernation.
You can enable hibernation only on new dev boxes created with hibernation-enabled dev box definitions. You can't enable hibernation on existing dev boxes.
You can hibernate a dev box only by using the Microsoft developer portal, the Azure CLI, PowerShell, SDKs, and the REST API. Hibernating from within the dev box in Windows isn't supported.
If you're working with an Azure Marketplace image, we recommend using the Visual Studio for dev box images.
The Windows 11 Enterprise CloudPC + OS Optimizations image contains optimized power settings, and they can't be used with hibernation.
After you enable hibernation, you can't disable the feature on that dev box. However, you can disable hibernation support on the dev box definition so dev boxes created in the future don't have hibernation.
To enable hibernation, you need to enable nested virtualization in your Windows OS. If the "Virtual Machine Platform" feature isn't enabled in your DevBox image, DevBox automatically enables nested virtualization for you if you choose to enable hibernation.
Hibernation doesn't support hypervisor-protected code integrity (HVCI)/ Memory Integrity features. Dev box disables this feature automatically.
Auto-stop schedules will hibernate Dev Boxes that were created after you enabled hibernation on the associated Dev Box definition. Dev Boxes that were created before you enabled hibernation on the Dev Box definition will continue to shut down.
Note
The functionality to schedule dev boxes to hibernate automatically is available as a public preview. You can read more about the announcement at Microsoft Dev Box - Auto-Hibernation Schedules Preview.
Settings not compatible with hibernation
The following settings are known to be incompatible with hibernation, and aren't supported for hibernation scenarios:
Memory Integrity/Hypervisor Code Integrity
To disable Memory Integrity/Hypervisor Code Integrity:
- In the Windows Start menu, find and open Windows Security.
- Go to Device Security.
- Under Core Isolation, select Core Isolation details
- Under Memory integrity, set the toggle to Off.
After you change this setting, you need to restart the machine.
Guest Virtual Secure Mode based features without Nested Virtualization enabled
To enable Nested Virtualization:
- In the Start menu, search for Turn Windows features on or off.
- In the dialog, select the Virtual Machine Platform checkbox.
- Select OK to save your setting changes.
Enable hibernation on your dev box image
If you plan to use a custom image from an Azure compute gallery, you need to enable hibernation capabilities when you create the new image. You can't enable hibernation for existing images.
Note
The Visual Studio and Microsoft 365 images that Microsoft Dev Box provides in Azure Marketplace are already configured to support hibernation. You don't need to enable hibernation on these images, they're ready to use.
To enable hibernation capabilities, set the IsHibernateSupported
flag to true
when you create the image:
az sig image-definition create
--resource-group <resourceGroupName> --gallery-name <galleryName> --gallery-image-definition <imageName> --location <location>
--publisher <publisherName> --offer <offerName> --sku <skuName> --os-type windows --os-state Generalized
--features "IsHibernateSupported=true SecurityType=TrustedLaunch" --hyper-v-generation V2
If you're using sysprep and a generalized VM to create a custom image, capture your image by using the Azure CLI:
az sig image-version create
--resource-group <resourceGroupName> --gallery-name <galleryName> --gallery-image-definition <imageName>
--gallery-image-version <versionNumber> --virtual-machine <VMResourceId>
For more information about creating a custom image, see Configure a dev box by using Azure VM Image Builder.
Enable hibernation on a dev box definition
In Microsoft Dev Box, you can enable hibernation for a new dev box definition when the definition uses a hibernation-enabled custom or Azure Marketplace image. You can also update an existing dev box definition that uses a hibernation-enabled custom or Azure Marketplace image.
All new dev boxes created in dev box pools that use a dev box definition with hibernation enabled can both hibernate and shut down. If a pool has dev boxes that were created before hibernation was enabled, those dev boxes continue to support shutdown only.
Microsoft Dev Box validates your image for hibernate support. Your dev box definition might fail validation if hibernation can't be successfully enabled by using your image.
You can enable hibernation on a dev box definition by using the Azure portal or the Azure CLI.
Enable hibernation in the Azure portal
Sign in to the Azure portal.
In the search box, enter dev center. In the list of results, select Dev centers.
Open the dev center that contains the dev box definition that you want to update, and then select Dev box definitions.
Select the dev box definition that you want to update, and then select the edit (pencil) button.
On the Edit dev box definition page, select the Enable hibernation checkbox.
Select Save.
Enable hibernation with the Azure CLI
To enable hibernation for the dev box definition from the Azure CLI, set the hibernateSupport
flag to Enabled
when you create the image:
az devcenter admin devbox-definition update
--dev-box-definition-name <devBoxDefinitionName> -–dev-center-name <devCenterName> --resource-group <resourceGroupName> –-hibernateSupport Enabled
Troubleshooting
If you enable hibernation on a Dev Box definition, but the definition reports that hibernation couldn't be enabled:
- We recommend using the Visual Studio for Dev Box marketplace images, either directly, or as base images for generating your custom image.
- The Windows + OS optimizations image contains optimized power settings, and they can't be used with hibernation.
- If you're using a custom Azure Compute Gallery image, enable hibernation on your Azure Compute Gallery image before enabling hibernation on your Dev Box definition.
- If hibernation can't be enabled on the definition even after you enable it on your gallery image, your custom image likely has a Windows configuration that prevents hibernation.
For more information, see Settings not compatible with hibernation.
Disable hibernation on a dev box definition
If you have issues provisioning new VMs after you enable hibernation on a pool, you can disable hibernation on the dev box definition. You can also disable hibernation when you want to revert the setting to only shutdown dev boxes.
You can disable hibernation on a dev box definition by using the Azure portal or the CLI.
Disable hibernation in the Azure portal
Sign in to the Azure portal.
In the search box, enter dev center. In the list of results, select Dev centers.
Open the dev center that contains the dev box definition that you want to update, and then select Dev box definitions.
Select the dev box definition that you want to update, and then select the edit (pencil) button.
On the Edit dev box definition page, clear the Enable hibernation checkbox.
Select Save.
Disable hibernation with the Azure CLI
To disable hibernation for the dev box definition from the Azure CLI, set the hibernateSupport
flag to Disabled
when you create the image:
az devcenter admin devbox-definition update
--dev-box-definition-name <devBoxDefinitionName> -–dev-center-name <devCenterName> --resource-group <resourceGroupName> –-hibernateSupport Disabled
Related content
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for