For a Windows Azure VM, the supported way to retry Azure Disk Encryption is to disable encryption and then enable it again. Removing or rerunning the extension alone is not sufficient.
Key points:
- Disable encryption first.
- PowerShell:
Disable-AzVMDiskEncryption -ResourceGroupName "MyVirtualMachineResourceGroup" -VMName "MySecureVM" -VolumeType "all" - Azure CLI:
az vm encryption disable --name "MySecureVM" --resource-group "MyVirtualMachineResourceGroup" --volume-type "all"
- PowerShell:
- Wait for decryption to finish.
- Disabling encryption starts a background BitLocker decryption process.
- Give it enough time to complete before attempting to enable encryption again.
- If both OS and data disks are encrypted, disable encryption on all disks. Disabling only data disk encryption in that case can have unexpected results.
- If needed, check encryption/decryption status.
- The documented status commands in the provided material are:
- PowerShell:
Get-AzVMDiskEncryptionStatus - Azure CLI:
az vm encryption show
- PowerShell:
- The documented status commands in the provided material are:
- Remove the extension only after decryption completes, if cleanup is required.
- If the goal is to decrypt disks and remove the extension, disable encryption before removing the extension.
- If the extension is removed before disabling encryption, the disks remain encrypted. Disabling afterward reinstalls the extension to perform decryption, and it must then be removed again.
- If the failure is specifically the Windows error
Azure Disk Encryption extension version '2.2' is not supported, use one of these supported workarounds before retrying enablement:- Use
Set-AzVMDiskEncryptionExtensionwith the Microsoft Entra parameters:-
-AadClientID -
-AadClientSecret
-
- Or register the
UnifiedDiskEncryptionForVMsfeature for the subscription:Register-AzProviderFeature -ProviderNamespace "Microsoft.Compute" -FeatureName "UnifiedDiskEncryptionForVMs" Register-AzResourceProvider -ProviderNamespace Microsoft.Compute
- Use
If the VM is currently in a BitLocker boot-error state, a simple stop/deallocate and start is a documented first recovery step because it forces the VM to retrieve the BEK file from Azure Key Vault and place it on the encrypted disk.
References: