Skip to content

Commit 48bf583

Browse files
authored
Merge pull request #191226 from Aarthi-Vijayaraghavan/pub_pr_tvm_ed
AV
2 parents e04f5fd + 3d0e8a3 commit 48bf583

File tree

4 files changed

+186
-149
lines changed

4 files changed

+186
-149
lines changed

articles/virtual-machines/TOC.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,11 @@
12621262
- name: Backup and disaster recovery for unmanaged disks
12631263
href: page-blobs-backup-and-disaster-recovery.md
12641264
- name: Ephemeral OS disks
1265-
href: ephemeral-os-disks.md
1265+
items:
1266+
- name: Overview
1267+
href: ephemeral-os-disks.md
1268+
- name: Create a VM using ephemeral OS disks
1269+
href: ephemeral-os-disks-deploy.md
12661270
- name: Securely import/export a disk
12671271
items:
12681272
- name: Configure private links for disks - CLI
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
title: Deploy Ephemeral OS disks
3+
description: Learn to deploy ephemeral OS disks for Azure VMs.
4+
author: Aarthi-Vijayaraghavan
5+
ms.service: virtual-machines
6+
ms.workload: infrastructure-services
7+
ms.topic: how-to
8+
ms.date: 07/23/2020
9+
ms.author: aarthiv
10+
ms.subservice: disks
11+
ms.custom: devx-track-azurepowershell, devx-track-azurecli
12+
---
13+
14+
# How to deploy Ephemeral OS disks for Azure VMs
15+
16+
**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+
![Screenshot showing the radio button for choosing to use an ephemeral OS disk](./media/virtual-machines-common-ephemeral/ephemeral-portal-temp.png)
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.
32+
33+
```json
34+
{
35+
"type": "Microsoft.Compute/virtualMachineScaleSets",
36+
"name": "myScaleSet",
37+
"location": "East US 2",
38+
"apiVersion": "2019-12-01",
39+
"sku": {
40+
"name": "Standard_DS2_v2",
41+
"capacity": "2"
42+
},
43+
"properties": {
44+
"upgradePolicy": {
45+
"mode": "Automatic"
46+
},
47+
"virtualMachineProfile": {
48+
"storageProfile": {
49+
"osDisk": {
50+
"diffDiskSettings": {
51+
"option": "Local" ,
52+
"placement": "ResourceDisk"
53+
},
54+
"caching": "ReadOnly",
55+
"createOption": "FromImage"
56+
},
57+
"imageReference": {
58+
"publisher": "Canonical",
59+
"offer": "UbuntuServer",
60+
"sku": "16.04-LTS",
61+
"version": "latest"
62+
}
63+
},
64+
"osProfile": {
65+
"computerNamePrefix": "myvmss",
66+
"adminUsername": "azureuser",
67+
"adminPassword": "P@ssw0rd!"
68+
}
69+
}
70+
}
71+
}
72+
```
73+
74+
## VM template deployment
75+
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-
135+
id}/resourceGroups/{rgName}/providers/Microsoft.Compute/VirtualMachines/{vmName}/reimage?a pi-version=2019-12-01"
136+
```
137+
138+
## PowerShell
139+
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).

articles/virtual-machines/ephemeral-os-disks.md

Lines changed: 24 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Key differences between persistent and ephemeral OS disks:
3030

3131
| | Persistent OS Disk | Ephemeral OS Disk |
3232
|---|---|---|
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 |
3535
| **Disk type support**| Managed and unmanaged OS disk| Managed OS disk only|
3636
| **Region support**| All regions| All regions|
3737
| **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
5858
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.
5959
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.
6060

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.
6463
[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.
6564
With this feature, when a Windows VM is provisioned, we configure the pagefile to be located on the OS Disk.
6665

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-
![Screenshot showing the radio button for choosing to use an ephemeral OS disk](./media/virtual-machines-common-ephemeral/ephemeral-portal-temp.png)
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.
79-
80-
```json
81-
{
82-
"type": "Microsoft.Compute/virtualMachineScaleSets",
83-
"name": "myScaleSet",
84-
"location": "East US 2",
85-
"apiVersion": "2019-12-01",
86-
"sku": {
87-
"name": "Standard_DS2_v2",
88-
"capacity": "2"
89-
},
90-
"properties": {
91-
"upgradePolicy": {
92-
"mode": "Automatic"
93-
},
94-
"virtualMachineProfile": {
95-
"storageProfile": {
96-
"osDisk": {
97-
"diffDiskSettings": {
98-
"option": "Local" ,
99-
"placement": "ResourceDisk"
100-
},
101-
"caching": "ReadOnly",
102-
"createOption": "FromImage"
103-
},
104-
"imageReference": {
105-
"publisher": "Canonical",
106-
"offer": "UbuntuServer",
107-
"sku": "16.04-LTS",
108-
"version": "latest"
109-
}
110-
},
111-
"osProfile": {
112-
"computerNamePrefix": "myvmss",
113-
"adminUsername": "azureuser",
114-
"adminPassword": "P@ssw0rd!"
115-
}
116-
}
117-
}
118-
}
119-
```
120-
121-
## VM template deployment
122-
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
17473

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.
17677

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.
17982

180-
```
181-
POST https://management.azure.com/subscriptions/{sub-
182-
id}/resourceGroups/{rgName}/providers/Microsoft.Compute/VirtualMachines/{vmName}/reimage?a pi-version=2019-12-01"
183-
```
184-
185-
## PowerShell
186-
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)
18988

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-
20089
## Frequently asked questions
20190

20291
**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
256145

257146
A: Yes, you can create VMs with Ephemeral OS Disk using REST, Templates, PowerShell, and CLI.
258147

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-
269148
> [!NOTE]
270149
>
271150
> 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.
272151
>
273152
274153
## 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

Comments
 (0)