Azure VM : Server boots into Bitlocker recovery mode......

 If you have a server in Azure and you are noticing that it boots into the recovery console and asks for the recovery keys, then follow this steps to remedy the situation:

BOLD sections need to ne updated as they are variables, as with anything on this blog you need to be sure of what you are doing before you go clicking around in the Azure portal.

  1. Created a rescue VM in the same subscription, resource group and region as the affected one and attached a copy of the affected OS disk as data disk
  2. Connected to the VM and confirmed that we see the affected disk locked in file explorer
  3. Once the guest agent become available in Azure portal on rescue VM, we went on disks -> additional settings -> Disks to encrypt, selected OS & data disk, then selected original key vault and created a new key (to be sure that old one is not expired)
  4. Once confirmed that the disks are unlocked on the troubleshooting VM, we have then proceeded with the below commands in Azure Cloud Shell -> Powershell to set the correct subscription, disable and remove the encryption:
  5. Set-AzContext -SubscriptionId <subscription ID>
  6. Disable-AzVMDiskEncryption -ResourceGroupName <rgname> -VMName '<vmname> -VolumeType "all"
  7. Remove-AzVMDiskEncryptionExtension -ResourceGroupName <rgname> -VMName <vmname>
  8. Check the rescue VM the progress for removing the encryption using an admin session for cmd and running the following command: manage-bde -status
  9. Once all the disk reached 0%, we have swapped the OS disk on the original VM but we reached the same BitLocker screen.

    If you also have boot issues with the OS then continue on, if not you are done at step 8.
  10. Then we have brought the Disk back on the recue VM, make it Offline from Disk Management and create a VM from it in Hyper-V, which requires installing the Hyper-V role on the recovery VM and mounted the disocnnected volume as the disk for Hyper-V to boot from
  11. The VM booted in recovery mode using Dart, the a startup repair was performed on the boot volume, the VM entered in check disk, repair, and afterwards booted up
  12. Next swap the disk on the original VM and confirmed we can login to it via RDP (ensuring 3389 is open on the NSG rules)
  13. As the data drive remained locked, we used (after creating snapshots for both OS disk and data disk) the procedure from step 3, and this way the data drive is unlocked
Please note you may not want to leave your disks unencrypted therefore to re-encrypt follow step three again to re-encrypt your disks
Previous Post Next Post

☕️ Buy me a coffee ?

If any of these articles have helped you out consider buying me a coffee, completely optional, but would be appreciated!

نموذج الاتصال