Proposed Pull Request Change

title description author ms.service ms.topic ms.date ms.author ms.subservice ms.custom
Deploy Ephemeral OS disks Learn to deploy ephemeral OS disks for Azure VMs. Aarthi-Vijayaraghavan azure-virtual-machines how-to 09/08/2026 aarthiv disks devx-track-azurecli
📄 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: Deploy Ephemeral OS disks description: Learn to deploy ephemeral OS disks for Azure VMs. author: Aarthi-Vijayaraghavan ms.service: azure-virtual-machines ms.topic: how-to ms.date: 09/08/2026 ms.author: aarthiv ms.subservice: disks ms.custom: devx-track-azurecli # Customer intent: "As a cloud administrator, I want to deploy virtual machines with ephemeral OS disks using various methods, so that I can improve performance and reduce costs in my Azure environment." --- # How to deploy Ephemeral OS disks for Azure VMs **Applies to:** :heavy_check_mark: Linux VMs :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets :heavy_check_mark: Uniform scale sets This article shows you how to create a virtual machine or virtual machine scale sets with Ephemeral OS disks through Portal, ARM template deployment, CLI and PowerShell. > [!NOTE] > Ephemeral OS disk with full caching is generally available in all Azure public regions for supported VM sizes with eight or more vCPUs. For the supported series and capacity requirements, see [Full caching mode for Ephemeral OS disks](ephemeral-os-disks.md#full-caching-mode-for-ephemeral-os-disks). ## Portal In the Azure portal, you can choose to use ephemeral disks when deploying a virtual machine or virtual machine scale sets. Open the **Advanced** section of the **Disks** tab. For choosing placement of Ephemeral OS disk, select **OS cache placement**, **Temp disk placement**, or **NVMe disk placement**. ![Screenshot showing the radio button for choosing to use an ephemeral OS disk](./media/virtual-machines-common-ephemeral/ephemeral-portal-temp.png) If the option for using an ephemeral disk or OS cache placement or Temp disk placement is greyed out, you might have selected a VM size that doesn't have a cache/temp size larger than the OS image or that doesn't support Premium storage. Go back to the **Basics** page and try choosing another VM size. ## Scale set template deployment with partial caching The process to create a scale set that uses an ephemeral OS disk is to add the `diffDiskSettings` property to the `Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile` resource type in the template. Also, set the caching policy to `ReadOnly` for the ephemeral OS disk. Change the placement to `CacheDisk` for OS cache disk placement, `ResourceDisk` for temp disk placement, or `NvmeDisk` for NVMe disk placement. ```json { "type": "Microsoft.Compute/virtualMachineScaleSets", "name": "myScaleSet", "location": "East US 2", "apiVersion": "2025-04-01", "sku": { "name": "Standard_D8ds_v6", "capacity": "2" }, "properties": { "upgradePolicy": { "mode": "Automatic" }, "virtualMachineProfile": { "storageProfile": { "osDisk": { "diffDiskSettings": { "option": "Local", "placement": "NvmeDisk" }, "caching": "ReadOnly", "createOption": "FromImage" }, "imageReference": { "publisher": "publisherName", "offer": "offerName", "sku": "skuName", "version": "imageVersion" } }, "osProfile": { "computerNamePrefix": "myvmss", "adminUsername": "azureuser", "adminPassword": "P@ssw0rd!" } } } } ``` > [!NOTE] > Replace all the other values accordingly. ## VM template deployment with partial caching You can deploy a VM with an ephemeral OS disk by using a template. To create a VM that uses ephemeral OS disks, add the `diffDiskSettings` property to the `Microsoft.Compute/virtualMachines` resource type in the template. Also, set the caching policy to `ReadOnly` for the ephemeral OS disk. Change the placement to `CacheDisk` for OS cache disk placement, `ResourceDisk` for temp disk placement, or `NvmeDisk` for NVMe disk placement. ```json { "type": "Microsoft.Compute/virtualMachines", "name": "myVirtualMachine", "location": "East US 2", "apiVersion": "2025-04-01", "properties": { "storageProfile": { "osDisk": { "diffDiskSettings": { "option": "Local", "placement": "NvmeDisk" }, "caching": "ReadOnly", "createOption": "FromImage" }, "imageReference": { "publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2016-Datacenter-smalldisk", "version": "latest" }, "hardwareProfile": { "vmSize": "Standard_D8ds_v6" } }, "osProfile": { "computerNamePrefix": "myvirtualmachine", "adminUsername": "azureuser", "adminPassword": "P@ssw0rd!" } } } ``` ### VM template deployment with full caching To deploy a VM with ephemeral OS disk with full caching, use API version `2025-04-01` or later and set `enableFullCaching` to `true` in the `diffDiskSettings` section. ```json { "type": "Microsoft.Compute/virtualMachines", "name": "myVirtualMachine", "location": "East US 2", "apiVersion": "2025-04-01", "properties": { "storageProfile": { "osDisk": { "diffDiskSettings": { "option": "Local", "placement": "NvmeDisk", "enableFullCaching": true }, "caching": "ReadOnly", "createOption": "FromImage", "managedDisk": { "storageAccountType": "StandardSSD_LRS" } }, "imageReference": { "publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2016-Datacenter-smalldisk", "version": "latest" }, "hardwareProfile": { "vmSize": "Standard_D8ds_v6" } }, "osProfile": { "computerNamePrefix": "myvirtualmachine", "adminUsername": "azureuser", "adminPassword": "P@ssw0rd!" } } } ``` ## CLI To use an ephemeral disk for a CLI VM deployment, set the `--ephemeral-os-disk` parameter in [az vm create](/cli/azure/vm#az-vm-create) to `true` and the `--ephemeral-os-disk-placement` parameter to `ResourceDisk` for temp disk placement or `CacheDisk` for cache disk placement and the `--os-disk-caching` parameter to `ReadOnly`. To enable full caching, also set `--ephemeral-os-disk-enable-full-caching` to `true`. ```azurecli-interactive az vm create \ --resource-group myResourceGroup \ --name myVM \ --image imageName \ --size Standard_D8ds_v6 \ --ephemeral-os-disk true \ --ephemeral-os-disk-placement NvmeDisk \ --ephemeral-os-disk-enable-full-caching true \ --os-disk-caching ReadOnly \ --admin-username azureuser \ --generate-ssh-keys ``` > [!NOTE] > Replace `myVM`, `myResourceGroup`, `imageName` and `azureuser` accordingly. For scale sets, use the same parameters with [az vmss create](/cli/azure/vmss#az-vmss-create), including `--ephemeral-os-disk-enable-full-caching true` to enable full caching. ## Reimage a VM using REST You can reimage a Virtual Machine instance with ephemeral OS disk using REST API as described below and via Azure portal by going to Overview pane of the VM. For scale sets, reimaging is already available through PowerShell, CLI, and the portal. ``` POST https://management.azure.com/subscriptions/{sub- id}/resourceGroups/{rgName}/providers/Microsoft.Compute/VirtualMachines/{vmName}/reimage?api-version=2019-12-01" ``` ## PowerShell To use an ephemeral disk for a PowerShell VM deployment, use [Set-AzVMOSDisk](/powershell/module/az.compute/set-azvmosdisk) in your VM configuration. Set the `-DiffDiskSetting` to `Local` and `-Caching` to `ReadOnly` and `-DiffDiskPlacement` to `ResourceDisk`. ```powershell Set-AzVMOSDisk -DiffDiskSetting Local -DiffDiskPlacement ResourceDisk -Caching ReadOnly ``` To use an ephemeral disk on cache disk for a PowerShell VM deployment, use [Set-AzVMOSDisk](/powershell/module/az.compute/set-azvmosdisk) in your VM configuration. Set the `-DiffDiskSetting` to `Local` , `-Caching` to `ReadOnly` and `-DiffDiskPlacement` to `CacheDisk`. ```PowerShell Set-AzVMOSDisk -DiffDiskSetting Local -DiffDiskPlacement CacheDisk -Caching ReadOnly ``` For scale set deployments, use the [Set-AzVmssStorageProfile](/powershell/module/az.compute/set-azvmssstorageprofile) cmdlet in your configuration. Set the `-DiffDiskSetting` to `Local` , `-Caching` to `ReadOnly` and `-DiffDiskPlacement` to `ResourceDisk` or `CacheDisk`. ```PowerShell Set-AzVmssStorageProfile -DiffDiskSetting Local -DiffDiskPlacement ResourceDisk -OsDiskCaching ReadOnly ``` ## Next steps For more information on [Ephemeral OS disk](ephemeral-os-disks.md).
Success! Branch created successfully. Create Pull Request on GitHub
Error: