Skip to content

Commit 4077187

Browse files
authored
Merge pull request #232728 from divargas-msft/patch-8
[Doc-a-thon] Updating disks-enable-host-based-encryption-cli
2 parents 80e31d0 + 29b4e60 commit 4077187

File tree

1 file changed

+31
-33
lines changed

1 file changed

+31
-33
lines changed

articles/virtual-machines/linux/disks-enable-host-based-encryption-cli.md

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Use encryption at host to enable end-to-end encryption on your Azur
44
author: roygara
55
ms.service: storage
66
ms.topic: how-to
7-
ms.date: 03/28/2023
7+
ms.date: 03/29/2023
88
ms.author: rogarana
99
ms.subservice: disks
1010
ms.custom: references_regions, devx-track-azurecli
@@ -31,17 +31,16 @@ You must enable the feature for your subscription before you use the EncryptionA
3131

3232
- Execute the following command to register the feature for your subscription
3333

34-
```azurecli
34+
```azurecli-interactive
3535
az feature register --namespace Microsoft.Compute --name EncryptionAtHost
3636
```
37-
37+
3838
- Check that the registration state is **Registered** (takes a few minutes) using the command below before trying out the feature.
3939

40-
```azurecli
40+
```azurecli-interactive
4141
az feature show --namespace Microsoft.Compute --name EncryptionAtHost
4242
```
4343

44-
4544
### Create resources
4645

4746
> [!NOTE]
@@ -53,16 +52,16 @@ Once the feature is enabled, you need to set up a DiskEncryptionSet and either a
5352

5453
## Example scripts
5554

56-
### Create a VM with encryption at host enabled with customer-managed keys.
55+
### Create a VM with encryption at host enabled with customer-managed keys
5756

58-
Create a VM with managed disks using the resource URI of the DiskEncryptionSet created earlier to encrypt cache of OS and data disks with customer-managed keys. The temp disks are encrypted with platform-managed keys.
57+
Create a VM with managed disks using the resource URI of the DiskEncryptionSet created earlier to encrypt cache of OS and data disks with customer-managed keys. The temp disks are encrypted with platform-managed keys.
5958

60-
```azurecli
59+
```azurecli-interactive
6160
rgName=yourRGName
6261
vmName=yourVMName
6362
location=eastus
6463
vmSize=Standard_DS2_v2
65-
image=UbuntuLTS
64+
image=LinuxImageURN
6665
diskEncryptionSetName=yourDiskEncryptionSetName
6766
6867
diskEncryptionSetId=$(az disk-encryption-set show -n $diskEncryptionSetName -g $rgName --query [id] -o tsv)
@@ -79,16 +78,16 @@ az vm create -g $rgName \
7978
--data-disk-encryption-sets $diskEncryptionSetId $diskEncryptionSetId
8079
```
8180

82-
### Create a VM with encryption at host enabled with platform-managed keys.
81+
### Create a VM with encryption at host enabled with platform-managed keys
8382

84-
Create a VM with encryption at host enabled to encrypt cache of OS/data disks and temp disks with platform-managed keys.
83+
Create a VM with encryption at host enabled to encrypt cache of OS/data disks and temp disks with platform-managed keys.
8584

86-
```azurecli
85+
```azurecli-interactive
8786
rgName=yourRGName
8887
vmName=yourVMName
8988
location=eastus
9089
vmSize=Standard_DS2_v2
91-
image=UbuntuLTS
90+
image=LinuxImageURN
9291
9392
az vm create -g $rgName \
9493
-n $vmName \
@@ -100,9 +99,9 @@ az vm create -g $rgName \
10099
--data-disk-sizes-gb 128 128 \
101100
```
102101

103-
### Update a VM to enable encryption at host.
102+
### Update a VM to enable encryption at host
104103

105-
```azurecli
104+
```azurecli-interactive
106105
rgName=yourRGName
107106
vmName=yourVMName
108107
@@ -113,7 +112,7 @@ az vm update -n $vmName \
113112

114113
### Check the status of encryption at host for a VM
115114

116-
```azurecli
115+
```azurecli-interactive
117116
rgName=yourRGName
118117
vmName=yourVMName
119118
@@ -122,12 +121,11 @@ az vm show -n $vmName \
122121
--query [securityProfile.encryptionAtHost] -o tsv
123122
```
124123

125-
126-
### Update a VM to disable encryption at host.
124+
### Update a VM to disable encryption at host
127125

128126
You must deallocate your VM before you can disable encryption at host.
129127

130-
```azurecli
128+
```azurecli-interactive
131129
rgName=yourRGName
132130
vmName=yourVMName
133131
@@ -136,24 +134,24 @@ az vm update -n $vmName \
136134
--set securityProfile.encryptionAtHost=false
137135
```
138136

139-
### Create a Virtual Machine Scale Set with encryption at host enabled with customer-managed keys.
137+
### Create a Virtual Machine Scale Set with encryption at host enabled with customer-managed keys
140138

141139
Create a Virtual Machine Scale Set with managed disks using the resource URI of the DiskEncryptionSet created earlier to encrypt cache of OS and data disks with customer-managed keys. The temp disks are encrypted with platform-managed keys.
142140

143-
```azurecli
141+
```azurecli-interactive
144142
rgName=yourRGName
145143
vmssName=yourVMSSName
146144
location=westus2
147145
vmSize=Standard_DS3_V2
148-
image=UbuntuLTS
146+
image=LinuxImageURN
149147
diskEncryptionSetName=yourDiskEncryptionSetName
150148
151149
diskEncryptionSetId=$(az disk-encryption-set show -n $diskEncryptionSetName -g $rgName --query [id] -o tsv)
152150
153151
az vmss create -g $rgName \
154152
-n $vmssName \
155153
--encryption-at-host \
156-
--image UbuntuLTS \
154+
--image $image \
157155
--upgrade-policy automatic \
158156
--admin-username azureuser \
159157
--generate-ssh-keys \
@@ -162,30 +160,30 @@ az vmss create -g $rgName \
162160
--data-disk-encryption-sets $diskEncryptionSetId $diskEncryptionSetId
163161
```
164162

165-
### Create a Virtual Machine Scale Set with encryption at host enabled with platform-managed keys.
163+
### Create a Virtual Machine Scale Set with encryption at host enabled with platform-managed keys
166164

167165
Create a Virtual Machine Scale Set with encryption at host enabled to encrypt cache of OS/data disks and temp disks with platform-managed keys.
168166

169-
```azurecli
167+
```azurecli-interactive
170168
rgName=yourRGName
171169
vmssName=yourVMSSName
172170
location=westus2
173171
vmSize=Standard_DS3_V2
174-
image=UbuntuLTS
172+
image=LinuxImageURN
175173
176174
az vmss create -g $rgName \
177175
-n $vmssName \
178176
--encryption-at-host \
179-
--image UbuntuLTS \
177+
--image $image \
180178
--upgrade-policy automatic \
181179
--admin-username azureuser \
182180
--generate-ssh-keys \
183181
--data-disk-sizes-gb 64 128 \
184182
```
185183

186-
### Update a Virtual Machine Scale Set to enable encryption at host.
184+
### Update a Virtual Machine Scale Set to enable encryption at host
187185

188-
```azurecli
186+
```azurecli-interactive
189187
rgName=yourRGName
190188
vmssName=yourVMName
191189
@@ -196,7 +194,7 @@ az vmss update -n $vmssName \
196194

197195
### Check the status of encryption at host for a Virtual Machine Scale Set
198196

199-
```azurecli
197+
```azurecli-interactive
200198
rgName=yourRGName
201199
vmssName=yourVMName
202200
@@ -205,11 +203,11 @@ az vmss show -n $vmssName \
205203
--query [virtualMachineProfile.securityProfile.encryptionAtHost] -o tsv
206204
```
207205

208-
### Update a Virtual Machine Scale Set to disable encryption at host.
206+
### Update a Virtual Machine Scale Set to disable encryption at host
209207

210208
You can disable encryption at host on your Virtual Machine Scale Set but, this will only affect VMs created after you disable encryption at host. For existing VMs, you must deallocate the VM, [disable encryption at host on that individual VM](#update-a-vm-to-disable-encryption-at-host), then reallocate the VM.
211209

212-
```azurecli
210+
```azurecli-interactive
213211
rgName=yourRGName
214212
vmssName=yourVMName
215213
@@ -245,7 +243,7 @@ When calling the [Resource Skus API](/rest/api/compute/resourceskus/list), check
245243

246244
For the Azure PowerShell module, use the [Get-AzComputeResourceSku](/powershell/module/az.compute/get-azcomputeresourcesku) cmdlet.
247245

248-
```powershell
246+
```azurepowershell-interactive
249247
$vmSizes=Get-AzComputeResourceSku | where{$_.ResourceType -eq 'virtualMachines' -and $_.Locations.Contains('CentralUSEUAP')}
250248
251249
foreach($vmSize in $vmSizes)

0 commit comments

Comments
 (0)