File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
articles/virtual-machines Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,19 @@ diskEncryptionSetId=$(az disk-encryption-set show -n $diskEncryptionSetName -g $
132
132
az vm create -g $rgName -n $vmName -l $location --image $image --size $vmSize --generate-ssh-keys --os-disk-encryption-set $diskEncryptionSetId --data-disk-sizes-gb 128 128 --data-disk-encryption-sets $diskEncryptionSetId $diskEncryptionSetId
133
133
```
134
134
135
+
136
+ #### Encrypt existing unattached managed disks
137
+
138
+ Your existing disks must not be attached to a running VM in order for you to encrypt them using the following script:
139
+
140
+ ``` azurecli
141
+ rgName=yourResourceGroupName
142
+ diskName=yourDiskName
143
+ diskEncryptionSetName=yourDiskEncryptionSetName
144
+
145
+ az disk update -n $diskName -g $rgName --encryption-type EncryptionAtRestWithCustomerKey --disk-encryption-set $diskEncryptionSetId
146
+ ```
147
+
135
148
#### Create a virtual machine scale set using a Marketplace image, encrypting the OS and data disks with customer-managed keys
136
149
137
150
``` azurecli
Original file line number Diff line number Diff line change @@ -174,6 +174,20 @@ Update-AzVM -ResourceGroupName $rgName -VM $vm
174
174
175
175
```
176
176
177
+ #### Encrypt existing unattached managed disks
178
+
179
+ Your existing disks must not be attached to a running VM in order for you to encrypt them using the following script:
180
+
181
+ ``` PowerShell
182
+ $rgName = "yourResourceGroupName"
183
+ $diskName = "yourDiskName"
184
+ $diskEncryptionSetName = "yourDiskEncryptionSetName"
185
+
186
+ $diskEncryptionSet = Get-AzDiskEncryptionSet -ResourceGroupName $rgName -Name $diskEncryptionSetName
187
+
188
+ New-AzDiskUpdateConfig -EncryptionType "EncryptionAtRestWithCustomerKey" -DiskEncryptionSetId $diskEncryptionSet.Id | Update-AzDisk -ResourceGroupName $rgName -DiskName $diskName
189
+ ```
190
+
177
191
#### Create a virtual machine scale set using a Marketplace image, encrypting the OS and data disks with customer-managed keys
178
192
179
193
``` PowerShell
You can’t perform that action at this time.
0 commit comments