Remediation
From Azure Portalβ
Note: Disks must be detached from VMs to have encryption changed.
- Go to
Virtual machines
. - For each virtual machine, go to
Settings
. - Click on
Disks
. - Click the ellipsis (
...
), then clickDetach
to detach the disk from the VM. - Now search for
Disks
and locate the unattached disk. - Click the disk then select
Encryption
. - Change your encryption type, then select your encryption set.
- Click
Save
. - Go back to the VM and re-attach the disk.
From PowerShellβ
$KVRGname = 'MyKeyVaultResourceGroup'; $VMRGName = 'MyVirtualMachineResourceGroup'; $vmName = 'MySecureVM'; $KeyVaultName = 'MySecureVault'; $KeyVault = Get-AzKeyVault -VaultName $KeyVaultName -ResourceGroupName $KVRGname; $diskEncryptionKeyVaultUrl = $KeyVault.VaultUri; $KeyVaultResourceId = $KeyVault.ResourceId; Set-AzVMDiskEncryptionExtension -ResourceGroupName $VMRGname -VMName $vmName -DiskEncryptionKeyVaultUrl $diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $KeyVaultResourceId;
NOTE: During encryption it is likely that a reboot will be required. It may take up to 15 minutes to complete the process.
For Linux machines you may need to set the -skipVmBackup
parameter.