|
| 1 | +--- |
| 2 | +title: Configure hibernation for Microsoft Dev Box |
| 3 | +titleSuffix: Microsoft Dev Box |
| 4 | +description: Learn how to enable, disable and troubleshoot hibernation for your dev boxes. |
| 5 | +services: dev-box |
| 6 | +ms.service: dev-box |
| 7 | +author: RoseHJM |
| 8 | +ms.author: rosemalcolm |
| 9 | +ms.date: 07/05/2023 |
| 10 | +ms.topic: how-to |
| 11 | +#Customer intent: As a platform engineer, I want dev box users to be able to hibernate their dev boxes as part of my cost management strategy and so that dev box users can resume their work where they left off. |
| 12 | +--- |
| 13 | + |
| 14 | +# How to configure Dev Box Hibernation (preview) |
| 15 | + |
| 16 | +Hibernating dev boxes at the end of the workday can help you save a substantial portion of your VM costs. It eliminates the need for developers to shut down their dev box and lose their open windows and applications. |
| 17 | + |
| 18 | +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. |
| 19 | + |
| 20 | +There are two steps in enabling hibernation; you must enable hibernation on your dev box image and enable hibernation on your dev box definition. |
| 21 | + |
| 22 | +> [!IMPORTANT] |
| 23 | +> Dev Box Hibernation is currently in PREVIEW. |
| 24 | +> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. |
| 25 | +
|
| 26 | + |
| 27 | +## Key concepts for hibernation-enabled images |
| 28 | + |
| 29 | +- The following SKUs support hibernation: 8, 16 vCPU SKUs. 32 vCPU SKUs do not support hibernation. |
| 30 | + |
| 31 | +- You can enable hibernation only on new dev boxes created with hibernation-enabled dev box definitions. You cannot enable hibernation on existing dev boxes. |
| 32 | + |
| 33 | +- You can hibernate a dev box only using the dev Portal, CLI, PowerShell, SDKs, and API. Hibernating from within the dev box in Windows is not supported. |
| 34 | + |
| 35 | +- If you use a marketplace image, we recommend using the Visual Studio for dev box images. |
| 36 | + |
| 37 | +- The Windows 11 Enterprise CloudPC + OS Optimizations image contains optimized power settings, and they cannot be used with hibernation. |
| 38 | + |
| 39 | +- Once enabled, you cannot disable hibernation on a dev box. However, you can disable hibernation support on the dev box definition so that future dev boxes do not have hibernation. |
| 40 | + |
| 41 | +- To enable hibernation, you need to enable nested virtualization in your Windows OS. If the "Virtual Machine Platform" feature is not enabled in your DevBox image, DevBox will automatically enable nested virtualization for you if you choose to enable hibernation. |
| 42 | + |
| 43 | +- Hibernation doesn't support hypervisor-protected code integrity (HVCI)/ Memory Integrity features. Dev box disables this feature automatically. |
| 44 | + |
| 45 | +- Auto-stop schedules still shutdown the dev boxes. If you want to hibernate your dev box, you can do it through the developer portal or using the CLI. |
| 46 | + |
| 47 | +### Settings not compatible with hibernation |
| 48 | + |
| 49 | +These settings are known to be incompatible with hibernation, and aren't supported for hibernation scenarios: |
| 50 | + |
| 51 | +- **Memory Integrity/Hypervisor Code Integrity.** |
| 52 | + |
| 53 | + To disable Memory Integrity/Hypervisor Code Integrity: |
| 54 | + 1. In the start menu, search for *memory integrity* |
| 55 | + 1. Select **Core Isolation** |
| 56 | + 1. Under **Memory integrity**, ensure that memory integrity is set to Off. |
| 57 | + |
| 58 | +- **Guest Virtual Secure Mode based features without Nested Virtualization enabled.** |
| 59 | + |
| 60 | + To enable Nested Virtualization: |
| 61 | + 1. In the start menu, search for *Turn Windows features on or off* |
| 62 | + 1. In Turn Windows features on or off, select **Virtual Machine Platform**, and then select **OK** |
| 63 | + |
| 64 | +## Enable hibernation on your dev box image |
| 65 | + |
| 66 | +The Visual Studio and Microsoft 365 images that dev Box provides in the Azure Marketplace are already configured to support hibernation. You don't need to enable hibernation on these images, they're ready to use. |
| 67 | + |
| 68 | +If you plan to use a custom image from an Azure Compute Gallery, you need to enable hibernation capabilities as you create the new image. To enable hibernation capabilities, set the IsHibernateSupported flag to true. You must set the IsHibernateSupported flag when you create the image, existing images cannot be modified. |
| 69 | + |
| 70 | +To enable hibernation capabilities, set the `IsHibernateSupported` flag to true: |
| 71 | + |
| 72 | +```azurecli-interactive |
| 73 | +az sig image-definition create / |
| 74 | + --resource-group <resourcegroupname> --gallery-name <galleryname> --gallery-image-definition <imageName> --location <location> / |
| 75 | + --publisher <publishername> --offer <offername> --sku <skuname> --os-type windows --os-state Generalized / |
| 76 | + --features "IsHibernateSupported=true SecurityType=TrustedLaunch" --hyper-v-generation V2 |
| 77 | +``` |
| 78 | + |
| 79 | +For more information about creating a custom image, see [Configure a dev box by using Azure VM Image Builder](how-to-customize-devbox-azure-image-builder.md). |
| 80 | + |
| 81 | +## Enable hibernation on a dev box definition |
| 82 | + |
| 83 | +You can enable hibernation as you create a dev box definition, providing that the dev box definition uses a hibernation-enabled custom or marketplace image. You can also update an existing dev box definition that uses a hibernation-enabled custom or marketplace image. |
| 84 | + |
| 85 | +All new dev boxes created in dev box pools that use a dev box definition with hibernation enabled can hibernate in addition to shutting down. If a pool has dev boxes that were created before hibernation was enabled, they continue to only support shutdown. |
| 86 | + |
| 87 | +Dev Box validates your image for hibernate support. Your dev box definition may fail validation if hibernation couldn't be successfully enabled using your image. |
| 88 | + |
| 89 | +### Enable hibernation on an existing dev box definition by using the Azure portal |
| 90 | + |
| 91 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
| 92 | + |
| 93 | +1. In the search box, enter **dev center**. In the list of results, select **Dev centers**. |
| 94 | + |
| 95 | +1. Open the dev center that contains the dev box definition that you want to update, and then select **Dev box definitions**. |
| 96 | + |
| 97 | + :::image type="content" source="./media/how-to-configure-dev-box-hibernation/select-dev-box-definitions.png" alt-text="Screenshot that shows the dev center overview page and the menu option for dev box definitions."::: |
| 98 | + |
| 99 | +1. Select the dev box definition that you want to update, and then select the edit button. |
| 100 | + |
| 101 | + :::image type="content" source="./media/how-to-configure-dev-box-hibernation/update-dev-box-definition.png" alt-text="Screenshot of the list of existing dev box definitions and the edit button."::: |
| 102 | + |
| 103 | +1. On the Editing \<dev box definition\> page, select **Enable hibernation**. |
| 104 | + |
| 105 | + :::image type="content" source="./media/how-to-configure-dev-box-hibernation/dev-box-pool-enable-hibernation.png" alt-text="Screenshot of the page for editing a dev box definition, with Enable hibernation selected.."::: |
| 106 | + |
| 107 | +1. Select **Save**. |
| 108 | + |
| 109 | +### Update an existing dev box definition by using the CLI |
| 110 | + |
| 111 | +```azurecli-interactive |
| 112 | +az devcenter admin devbox-definition update --dev-box-definition-name <DevBoxDefinitionName> -–dev-center-name <devcentername> --resource-group <resourcegroupname> –-hibernateSupport enabled |
| 113 | +``` |
| 114 | + |
| 115 | +## Disable hibernation on a dev box definition |
| 116 | + |
| 117 | + If you have issues provisioning new VMs after enabling hibernation on a pool or you want to revert to shut down only dev boxes, you can disable hibernation on the dev box definition. |
| 118 | + |
| 119 | +### Disable hibernation on an existing dev box definition by using the Azure portal |
| 120 | + |
| 121 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
| 122 | + |
| 123 | +1. In the search box, enter **dev center**. In the list of results, select **Dev centers**. |
| 124 | + |
| 125 | +1. Open the dev center that contains the dev box definition that you want to update, and then select **Dev box definitions**. |
| 126 | + |
| 127 | +1. Select the dev box definition that you want to update, and then select the edit button. |
| 128 | + |
| 129 | +1. On the Editing \<dev box definition\> page, clear **Enable hibernation**. |
| 130 | + |
| 131 | + :::image type="content" source="./media/how-to-configure-dev-box-hibernation/dev-box-pool-disable-hibernation.png" alt-text="Screenshot of the page for editing a dev box definition, with Enable hibernation not selected."::: |
| 132 | + |
| 133 | +1. Select **Save**. |
| 134 | + |
| 135 | +### Disable hibernation on an existing dev box definition by using the CLI |
| 136 | + |
| 137 | +```azurecli-interactive |
| 138 | +az devcenter admin devbox-definition update --dev-box-definition-name <DevBoxDefinitionName> -–dev-center-name <devcentername> --resource-group <resourcegroupname> –-hibernateSupport disabled |
| 139 | +``` |
| 140 | + |
| 141 | +## Next steps |
| 142 | + |
| 143 | +- [Create a dev box pool](how-to-manage-dev-box-pools.md) |
| 144 | +- [Configure a dev box by using Azure VM Image Builder](how-to-customize-devbox-azure-image-builder.md) |
| 145 | +- [How to hibernate your dev box](how-to-hibernate-your-dev-box.md) |
| 146 | +- [CLI Reference for az devcenter admin devbox-definition update](/cli/azure/devcenter/admin/devbox-definition?view=azure-cli-latest&preserve-view=true) |
0 commit comments