Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: ✔️ Linux VMs ✔️ Windows VMs ✔️ Flexible scale sets ✔️ 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 for supported VM sizes with eight or more vCPUs. For the supported series and capacity requirements, see 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 Ephemeral OS disk.

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, or ResourceDisk for temp disk placement
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "myScaleSet",
"location": "China North 2",
"apiVersion": "2025-04-01",
"sku": {
"name": "Standard_DS2_v2",
"capacity": "2"
},
"properties": {
"upgradePolicy": {
"mode": "Automatic"
},
"virtualMachineProfile": {
"storageProfile": {
"osDisk": {
"diffDiskSettings": {
"option": "Local",
"placement": "ResourceDisk"
},
"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, or ResourceDisk for temp disk placement.
{
"type": "Microsoft.Compute/virtualMachines",
"name": "myVirtualMachine",
"location": "China North 2",
"apiVersion": "2025-04-01",
"properties": {
"storageProfile": {
"osDisk": {
"diffDiskSettings": {
"option": "Local",
"placement": "ResourceDisk"
},
"caching": "ReadOnly",
"createOption": "FromImage"
},
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter-smalldisk",
"version": "latest"
},
"hardwareProfile": {
"vmSize": "Standard_DS2_v2"
}
},
"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.
{
"type": "Microsoft.Compute/virtualMachines",
"name": "myVirtualMachine",
"location": "China North 2",
"apiVersion": "2025-04-01",
"properties": {
"storageProfile": {
"osDisk": {
"diffDiskSettings": {
"option": "Local",
"placement": "ResourceDisk",
"enableFullCaching": true
},
"caching": "ReadOnly",
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "StandardSSD_LRS"
}
},
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter-smalldisk",
"version": "latest"
},
"hardwareProfile": {
"vmSize": "Standard_DS2_v2"
}
},
"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 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.
az vm create \
--resource-group myResourceGroup \
--name myVM \
--image imageName \
--size Standard_DS2_v2 \
--ephemeral-os-disk true \
--ephemeral-os-disk-placement ResourceDisk \
--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, 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.chinacloudapi.cn/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 in your VM configuration. Set the -DiffDiskSetting to Local and -Caching to ReadOnly and -DiffDiskPlacement to ResourceDisk.
Set-AzVMOSDisk -DiffDiskSetting Local -DiffDiskPlacement ResourceDisk -Caching ReadOnly
To use an ephemeral disk on cache disk for a PowerShell VM deployment, use Set-AzVMOSDisk in your VM configuration. Set the -DiffDiskSetting to Local , -Caching to ReadOnly and -DiffDiskPlacement to CacheDisk.
Set-AzVMOSDisk -DiffDiskSetting Local -DiffDiskPlacement CacheDisk -Caching ReadOnly
For scale set deployments, use the Set-AzVmssStorageProfile cmdlet in your configuration. Set the -DiffDiskSetting to Local , -Caching to ReadOnly and -DiffDiskPlacement to ResourceDisk or CacheDisk.
Set-AzVmssStorageProfile -DiffDiskSetting Local -DiffDiskPlacement ResourceDisk -OsDiskCaching ReadOnly
Next steps
For more information on Ephemeral OS disk.