You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Applies to:**:heavy_check_mark: Linux VMs :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets :heavy_check_mark: Uniform scale sets
17
+
18
+
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.
19
+
20
+
## Portal
21
+
22
+
In the Azure portal, you can choose to use ephemeral disks when deploying a virtual machine or virtual machine scale sets by opening the **Advanced** section of the **Disks** tab. For choosing placement of Ephemeral OS disk, select **OS cache placement** or **Temp disk placement**.
23
+
24
+

25
+
26
+
27
+
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.
28
+
29
+
## Scale set template deployment
30
+
The process to create a scale set that uses an ephemeral OS disk is to add the `diffDiskSettings` property to the
31
+
`Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile` resource type in the template. Also, the caching policy must be set to `ReadOnly` for the ephemeral OS disk. placement can be changed to `CacheDisk` for OS cache disk placement.
You can deploy a VM with an ephemeral OS disk using a template. The process to create a VM that uses ephemeral OS disks is to add the `diffDiskSettings` property to Microsoft.Compute/virtualMachines resource type in the template. Also, the caching policy must be set to `ReadOnly` for the ephemeral OS disk. placement option can be changed to `CacheDisk` for OS cache disk placement.
76
+
77
+
```json
78
+
{
79
+
"type": "Microsoft.Compute/virtualMachines",
80
+
"name": "myVirtualMachine",
81
+
"location": "East US 2",
82
+
"apiVersion": "2019-12-01",
83
+
"properties": {
84
+
"storageProfile": {
85
+
"osDisk": {
86
+
"diffDiskSettings": {
87
+
"option": "Local" ,
88
+
"placement": "ResourceDisk"
89
+
},
90
+
"caching": "ReadOnly",
91
+
"createOption": "FromImage"
92
+
},
93
+
"imageReference": {
94
+
"publisher": "MicrosoftWindowsServer",
95
+
"offer": "WindowsServer",
96
+
"sku": "2016-Datacenter-smalldisk",
97
+
"version": "latest"
98
+
},
99
+
"hardwareProfile": {
100
+
"vmSize": "Standard_DS2_v2"
101
+
}
102
+
},
103
+
"osProfile": {
104
+
"computerNamePrefix": "myvirtualmachine",
105
+
"adminUsername": "azureuser",
106
+
"adminPassword": "P@ssw0rd!"
107
+
}
108
+
}
109
+
}
110
+
```
111
+
112
+
## CLI
113
+
114
+
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`.
115
+
116
+
```azurecli-interactive
117
+
az vm create \
118
+
--resource-group myResourceGroup \
119
+
--name myVM \
120
+
--image UbuntuLTS \
121
+
--ephemeral-os-disk true \
122
+
--ephemeral-os-disk-placement ResourceDisk \
123
+
--os-disk-caching ReadOnly \
124
+
--admin-username azureuser \
125
+
--generate-ssh-keys
126
+
```
127
+
128
+
For scale sets, you use the same `--ephemeral-os-disk true` parameter for [az-vmss-create](/cli/azure/vmss#az_vmss_create) and set the `--os-disk-caching` parameter to `ReadOnly` and the `--ephemeral-os-disk-placement` parameter to `ResourceDisk` for temp disk placement or `CacheDisk` for cache disk placement.
129
+
130
+
## Reimage a VM using REST
131
+
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.
132
+
133
+
```
134
+
POST https://management.azure.com/subscriptions/{sub-
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`.
140
+
```powershell
141
+
Set-AzVMOSDisk -DiffDiskSetting Local -DiffDiskPlacement ResourceDisk -Caching ReadOnly
142
+
143
+
```
144
+
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`.
145
+
```PowerShell
146
+
Set-AzVMOSDisk -DiffDiskSetting Local -DiffDiskPlacement CacheDisk -Caching ReadOnly
147
+
```
148
+
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`.
149
+
```PowerShell
150
+
Set-AzVmssStorageProfile -DiffDiskSetting Local -DiffDiskPlacement ResourceDisk -OsDiskCaching ReadOnly
151
+
```
152
+
153
+
## Next steps
154
+
For more information on [Ephemeral OS disk](ephemeral-os-disks.md).
@@ -30,8 +30,8 @@ Key differences between persistent and ephemeral OS disks:
30
30
31
31
|| Persistent OS Disk | Ephemeral OS Disk |
32
32
|---|---|---|
33
-
|**Size limit for OS disk**| 2 TiB | Cache size for the VM size or 2 TiB, whichever is smaller. For the **cache size in GiB**, see [DS](sizes-general.md), [ES](sizes-memory.md), [M](sizes-memory.md), [FS](sizes-compute.md), and [GS](sizes-previous-gen.md#gs-series)|
34
-
|**VM sizes supported**| All | VM sizes that support Premium storage such as DSv1, DSv2, DSv3, Esv3, Fs, FsV2, GS, M, Mdsv2,Bs, Dav4, Eav4 |
33
+
|**Size limit for OS disk**| 2 TiB | Cache size or temp size for the VM size or 2040 GiB, whichever is smaller. For the **cache or temp size in GiB**, see [DS](sizes-general.md), [ES](sizes-memory.md), [M](sizes-memory.md), [FS](sizes-compute.md), and [GS](sizes-previous-gen.md#gs-series)|
34
+
|**VM sizes supported**| All | VM sizes that support Premium storage such as DSv1, DSv2, DSv3, Esv3, Fs, FsV2, GS, M, Mdsv2,Bs, Dav4, Eav4 |
35
35
|**Disk type support**| Managed and unmanaged OS disk| Managed OS disk only|
36
36
|**Region support**| All regions| All regions|
37
37
|**Data persistence**| OS disk data written to OS disk are stored in Azure Storage| Data written to OS disk is stored on local VM storage and isn't persisted to Azure Storage. |
@@ -58,145 +58,34 @@ If you want to opt for **Temp disk placement**: Standard Ubuntu server image fro
58
58
Basic Linux and Windows Server images in the Marketplace that are denoted by `[smallsize]` tend to be around 30 GiB and can use most of the available VM sizes.
59
59
Ephemeral disks also require that the VM size supports **Premium storage**. The sizes usually (but not always) have an `s` in the name, like DSv2 and EsV3. For more information, see [Azure VM sizes](sizes.md) for details around which sizes support Premium storage.
60
60
61
-
## Ephemeral OS Disks can now be stored on temp/Resource disks
62
-
Ephemeral OS disk can now be stored either in VM cache disk or VM temp/resource disk.
63
-
This feature enables Ephemeral OS disks to be created for all the VMs, which don't have cache or have insufficient cache (such as Dav3, Dav4, Eav4, and Eav3) but has sufficient temp disk to host the Ephemeral OS disk.
61
+
## Placement options for Ephemeral OS disks
62
+
Ephemeral OS disk can be stored either on VM's OS cache disk or VM's temp/resource disk.
64
63
[DiffDiskPlacement](/rest/api/compute/virtualmachines/list#diffdiskplacement) is the new property that can be used to specify where you want to place the Ephemeral OS disk.
65
64
With this feature, when a Windows VM is provisioned, we configure the pagefile to be located on the OS Disk.
66
65
67
-
## Portal
68
-
69
-
In the Azure portal, you can choose to use ephemeral disks when deploying a virtual machine or virtual machine scale sets by opening the **Advanced** section of the **Disks** tab. For choosing placement of Ephemeral OS disk, select **OS cache placement** or **Temp disk placement**.
70
-
71
-

72
-
73
-
74
-
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.
75
-
76
-
## Scale set template deployment
77
-
The process to create a scale set that uses an ephemeral OS disk is to add the `diffDiskSettings` property to the
78
-
`Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile` resource type in the template. Also, the caching policy must be set to `ReadOnly` for the ephemeral OS disk. placement can be changed to `CacheDisk` for OS cache disk placement.
You can deploy a VM with an ephemeral OS disk using a template. The process to create a VM that uses ephemeral OS disks is to add the `diffDiskSettings` property to Microsoft.Compute/virtualMachines resource type in the template. Also, the caching policy must be set to `ReadOnly` for the ephemeral OS disk. placement option can be changed to `CacheDisk` for OS cache disk placement.
123
-
124
-
```json
125
-
{
126
-
"type": "Microsoft.Compute/virtualMachines",
127
-
"name": "myVirtualMachine",
128
-
"location": "East US 2",
129
-
"apiVersion": "2019-12-01",
130
-
"properties": {
131
-
"storageProfile": {
132
-
"osDisk": {
133
-
"diffDiskSettings": {
134
-
"option": "Local" ,
135
-
"placement": "ResourceDisk"
136
-
},
137
-
"caching": "ReadOnly",
138
-
"createOption": "FromImage"
139
-
},
140
-
"imageReference": {
141
-
"publisher": "MicrosoftWindowsServer",
142
-
"offer": "WindowsServer",
143
-
"sku": "2016-Datacenter-smalldisk",
144
-
"version": "latest"
145
-
},
146
-
"hardwareProfile": {
147
-
"vmSize": "Standard_DS2_v2"
148
-
}
149
-
},
150
-
"osProfile": {
151
-
"computerNamePrefix": "myvirtualmachine",
152
-
"adminUsername": "azureuser",
153
-
"adminPassword": "P@ssw0rd!"
154
-
}
155
-
}
156
-
}
157
-
```
158
-
159
-
## CLI
160
-
161
-
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`.
162
-
163
-
```azurecli-interactive
164
-
az vm create \
165
-
--resource-group myResourceGroup \
166
-
--name myVM \
167
-
--image UbuntuLTS \
168
-
--ephemeral-os-disk true \
169
-
--ephemeral-os-disk-placement ResourceDisk \
170
-
--os-disk-caching ReadOnly \
171
-
--admin-username azureuser \
172
-
--generate-ssh-keys
173
-
```
66
+
## Unsupported features
67
+
- Capturing VM images
68
+
- Disk snapshots
69
+
- Azure Disk Encryption
70
+
- Azure Backup
71
+
- Azure Site Recovery
72
+
- OS Disk Swap
174
73
175
-
For scale sets, you use the same `--ephemeral-os-disk true` parameter for [az-vmss-create](/cli/azure/vmss#az_vmss_create) and set the `--os-disk-caching` parameter to `ReadOnly` and the `--ephemeral-os-disk-placement` parameter to `ResourceDisk` for temp disk placement or `CacheDisk` for cache disk placement.
74
+
## Trusted Launch for Ephemeral OS disks (Preview)
75
+
Ephemeral OS disks can be created with Trusted launch. Not all VM sizes and regions are supported for trusted launch. Please check [limitations of trusted launch](trusted-launch.md#limitations) for supported sizes and regions.
76
+
VM guest state (VMGS) is specific to trusted launch VMs. It is a blob that is managed by Azure and contains the unified extensible firmware interface (UEFI) secure boot signature databases and other security information. While using trusted launch by default **1 GiB** from the **OS cache** or **temp storage** based on the chosen placement option is reserved for VMGS.The lifecycle of the VMGS blob is tied to that of the OS Disk.
176
77
177
-
## Reimage a VM using REST
178
-
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.
78
+
For example, If you try to create a Trusted launch Ephemeral OS disk VM using OS image of size 56 GiB with VM size [Standard_DS4_v2](dv2-dsv2-series.md) using temp disk placement you would get an error as
79
+
**"OS disk of Ephemeral VM with size greater than 55 GB is not allowed for VM size Standard_DS4_v2 when the DiffDiskPlacement is ResourceDisk."**
80
+
This is because the temp storage for [Standard_DS4_v2](dv2-dsv2-series.md) is 56 GiB, and 1 GiB is reserved for VMGS when using trusted launch.
81
+
For the same example above if you create a standard Ephemeral OS disk VM you would not get any errors and it would be a successful operation.
179
82
180
-
```
181
-
POST https://management.azure.com/subscriptions/{sub-
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`.
187
-
```powershell
188
-
Set-AzVMOSDisk -DiffDiskSetting Local -DiffDiskPlacement ResourceDisk -Caching ReadOnly
83
+
> [!NOTE]
84
+
>
85
+
> While using ephemeral disks for Trusted Launch VMs, keys and secrets generated or sealed by the vTPM after VM creation may not be persisted for operations like reimaging and platform events like service healing.
86
+
>
87
+
For more information on [how to deploy a trusted launch VM](trusted-launch-portal.md)
189
88
190
-
```
191
-
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`.
192
-
```PowerShell
193
-
Set-AzVMOSDisk -DiffDiskSetting Local -DiffDiskPlacement CacheDisk -Caching ReadOnly
194
-
```
195
-
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`.
196
-
```PowerShell
197
-
Set-AzVmssStorageProfile -DiffDiskSetting Local -DiffDiskPlacement ResourceDisk -OsDiskCaching ReadOnly
198
-
```
199
-
200
89
## Frequently asked questions
201
90
202
91
**Q: What is the size of the local OS Disks?**
@@ -256,20 +145,10 @@ A: No, you can't have a mix of ephemeral and persistent OS disk instances within
256
145
257
146
A: Yes, you can create VMs with Ephemeral OS Disk using REST, Templates, PowerShell, and CLI.
258
147
259
-
**Q: What features are not supported with ephemeral OS disk?**
260
-
261
-
A: Ephemeral disks do not support:
262
-
- Capturing VM images
263
-
- Disk snapshots
264
-
- Azure Disk Encryption
265
-
- Azure Backup
266
-
- Azure Site Recovery
267
-
- OS Disk Swap
268
-
269
148
> [!NOTE]
270
149
>
271
150
> Ephemeral disk will not be accessible through the portal. You will receive a "Resource not Found" or "404" error when accessing the ephemeral disk which is expected.
272
151
>
273
152
274
153
## Next steps
275
-
You can create a VM with an ephemeral OS disk using the [Azure CLI](/cli/azure/vm#az_vm_create).
154
+
Create a VM with ephemeral OS disk using [Azure Portal/CLI/Powershell/ARM template](ephemeral-os-disks-deploy.md).
0 commit comments