I have tried Linux VM encryption and faced many issues. I made some points before going to enable the disk encryption on Linux VM in Azure.
Disabling encryption on Linux VMs is only supported for data volumes. It is not supported on data or OS volumes if the OS volume has been encrypted.
If VM is not booting after encryption then only VM restoration option is available. You cannot resolve the issue.
Before enabling the disk encryption, we have to prepare the some question’s answer.
- Have a working backup for the vm which you are going to encrypt it.
- Make sure that the VM has enough RAM(minimum 7Gb) and also enough space in the OSDisk.
- Make sure that the application is stopped prior to the encryption process is started, also make sure that the application remains stopped after a reboot also, as the ADE process will reboot the vm.
- Make sure that the vm is not accessed by any means being it ssh or winscp or any other tools.
- Make sure that there is no extension installed in the vm.
- Make sure that there is no server hardening is done on the vm which is going to encrypted i.e, Kernel Parameter changes, Grub password setting, boot password setting
- You can monitor the encryption status using the PowerShell or azure cli commands or checking the serial console.
- if you are using datadisk, make sure that the file system type is ext4 and not xfs, because xfs file system is not supported for single pass encryption
- Remove the old kernels which are no longer required and regenerate the grub.cfg file. Keep only 3-4 Old Kernels if required.
Azure Disk Encryption does not work for the following scenarios, features, and technology:
• Encrypting basic tier VM or VMs created through the classic VM creation method.
• Disabling encryption on an OS drive or data drive of a Linux VM when the OS drive is encrypted.
• Encrypting OS drive for Linux virtual machine scale sets.
• Encrypting custom images on Linux VMs.
• Integration with an on-premises key management system.
• Azure Files (shared file system).
• Network File System (NFS).
• Dynamic volumes.
Azure Disk Encryption prerequisites
https://docs.microsoft.com/en-us/azure/security/azure-security-disk-encryption-prerequisites
Enable Azure Disk Encryption for Linux IaaS VMs
https://docs.microsoft.com/en-us/azure/security/azure-security-disk-encryption-linux
How to encrypt a Linux virtual machine in Azure
https://docs.microsoft.com/bs-latn-ba/azure/virtual-machines/linux/encrypt-disks