Migrate from Azure Disk Encryption to encryption at host

This article provides step-by-step guidance for migrating your virtual machines from Azure Disk Encryption (ADE) to encryption at host. The migration process requires creating new disks and VMs, as in-place conversion is not supported.

Migration overview

Azure Disk Encryption (ADE) encrypts data within the VM using BitLocker (Windows) or dm-crypt (Linux), while encryption at host encrypts data at the VM host level without consuming VM CPU resources. Encryption at host enhances Azure's default server-side encryption (SSE) by providing end-to-end encryption for all VM data, including temp disks, caches, and data flows between compute and storage.

For more information, see Overview of managed disk encryption options and Enable end-to-end encryption using encryption at host.

Migration limitations and considerations

Before starting the migration process, be aware of these important limitations and considerations that affect your migration strategy:

  • No in-place migration: You cannot directly convert ADE-encrypted disks to encryption at host. Migration requires creating new disks and VMs.

  • Linux OS disk limitation: Disabling ADE on Linux OS disks is not supported. For Linux VMs with ADE-encrypted OS disks, you must create a new VM with a new OS disk.

  • Windows ADE encryption patterns: On Windows VMs, Azure Disk Encryption can only encrypt the OS disk alone OR all disks (OS + data disks). It's not possible to encrypt only data disks on Windows VMs.

  • UDE flag persistence: Disks encrypted with Azure Disk Encryption have a Unified Data Encryption (UDE) flag that persists even after decryption. Both snapshots and disk copies using the Copy option retain this UDE flag. The migration requires creating new managed disks using the Upload method and copying the VHD blob data, which creates a new disk object without any metadata from the source disk.

  • Downtime required: The migration process requires VM downtime for disk operations and VM recreation.

  • Domain-joined VMs: If your VMs are part of an Active Directory domain, more steps are required:

    • The original VM must be removed from the domain before deletion
    • After creating the new VM, it must be rejoined to the domain
    • For Linux VMs, domain joining can be accomplished using Azure AD extensions

    For more information, see What is Microsoft Entra Domain Services?

Prerequisites

Before starting the migration:

  1. Backup your data: Create backups of all critical data before beginning the migration process.

  2. Test the process: If possible, test the migration process on a nonproduction VM first.

  3. Prepare encryption resources: Ensure your VM size supports encryption at host. Most current VM sizes support this feature. For more information about VM size requirements, see Enable end-to-end encryption using encryption at host.

  4. Document configuration: Record your current VM configuration, including network settings, extensions, and attached resources.

Migration steps

The following migration steps work for most scenarios, with specific differences noted for each operating system.

Important

Linux VMs with encrypted OS disks cannot be decrypted in-place. For these VMs, you must create a new VM with a new OS disk and migrate your data. See the Migrating Linux VMs with encrypted OS disks section after reviewing the general process below.

Disable Azure Disk Encryption

First step is to disable the existing Azure Disk Encryption when possible:

Create new managed disks

Create new disks that don't carry over the ADE encryption metadata. This process works for both Windows and Linux VMs, with some specific considerations for Linux OS disks.

# Get the source disk ID
SOURCE_DISK_ID=$(az disk show --resource-group "MyResourceGroup" --name "MySourceDisk" --query "id" -o tsv)

# Create a new disk from the source disk
az disk create --resource-group "MyResourceGroup" --name "MyTargetDisk" 
  --source "$SOURCE_DISK_ID" --upload-type "Copy"

# For OS disks, specify --os-type "Linux" or --os-type "Windows"

Note

This method creates new disks without the Azure Disk Encryption metadata (UDE flag), which is essential for a clean migration.

Important: When copying a managed disk from Azure, add 512 bytes to the disk size to account for the footer that Azure omits when reporting disk size.

Create a new VM with encryption

Create a new VM using the newly created disks with your chosen encryption method.

You can choose from several encryption options, depending on your security requirements. This article provides steps for creating a new VM with encryption at host, which is the most common migration path. Other encryption options are covered in Overview of managed disk encryption options.

Create a new VM with encryption at host

Encryption at host provides the closest equivalent to Azure Disk Encryption's coverage, and is covered in this section.

For OS disks:

# For Windows OS disks
az vm create 
  --resource-group "MyResourceGroup" 
  --name "MyVM-New" 
  --os-type "Windows" 
  --attach-os-disk "MyTargetDisk" 
  --encryption-at-host true

# For Linux OS disks
# az vm create 
#   --resource-group "MyResourceGroup" 
#   --name "MyVM-New" 
#   --os-type "Linux" 
#   --attach-os-disk "MyTargetDisk" 
#   --encryption-at-host true

For data disks:

# Enable encryption at host on the VM
az vm update 
  --resource-group "MyResourceGroup" 
  --name "MyVM-New" 
  --encryption-at-host true

# Attach the newly created data disk
az vm disk attach 
  --resource-group "MyResourceGroup" 
  --vm-name "MyVM-New" 
  --name "MyTargetDisk"

Verify and configure the new disks

After creating the new VM with encryption at host, you need to verify and configure the disks properly for your operating system.

For Windows VMs:

  • Verify disk letters are assigned correctly
  • Check that applications can access the disks correctly
  • Update any applications or scripts that reference specific disk IDs

For Linux VMs:

  • Update /etc/fstab with the new disk UUIDs
  • Mount the data disks to the correct mount points
# Get UUIDs of all disks
sudo blkid

# Mount all disks defined in fstab
sudo mount -a

Both Windows and Linux may require additional configuration steps specific to your applications or workloads.

Verify encryption and cleanup

Verify that encryption at host is properly configured on both Windows and Linux VMs.

# Check encryption at host status
az vm show --resource-group "MyResourceGroup" --name "MyVM-New" --query "securityProfile.encryptionAtHost"

After confirming that encryption at host is working properly:

  1. Test VM functionality to ensure applications work correctly
  2. Verify that data is accessible and intact
  3. Delete the original resources when you're satisfied with the migration:
# Delete the original VM
az vm delete --resource-group "MyResourceGroup" --name "MyVM-Original" --yes

# Delete the original disk
az disk delete --resource-group "MyResourceGroup" --name "MySourceDisk" --yes

Migrating Linux VMs with encrypted OS disks

Since you cannot disable encryption on Linux OS disks, the process is different from Windows.

  1. Create a new VM with encryption at host enabled

    az vm create \
      --resource-group "MyResourceGroup" \
      --name "MyVM-New" \
      --image "Ubuntu2204" \
      --encryption-at-host true \
      --admin-username "azureuser" \
      --generate-ssh-keys
    
  2. For data migration options:

    • For application data: Use SCP, rsync, or other file transfer methods to copy data
    • For configuration: Replicate important configuration files and settings
    • For complex applications: Use backup/restore procedures appropriate for your applications
    # Example of using SCP to copy files from source to new VM
    az vm run-command invoke -g MyResourceGroup -n MyVM-Original --command-id RunShellScript \
      --scripts "scp -r /path/to/data azureuser@new-vm-ip:/path/to/destination"
    

After creating the new VM:

  1. Configure the new VM to match the original environment

    • Set up the same network configurations
    • Install the same applications and services
    • Apply the same security settings
  2. Test thoroughly before decommissioning the original VM

This approach works for both Windows and Linux VMs, but is especially important for Linux VMs with encrypted OS disks that cannot be decrypted in-place.

For guidance on data migration, see Upload a VHD to Azure and Copy files to a Linux VM using SCP.

Domain-joined VM considerations

If your VMs are members of an Active Directory domain, additional steps are required during the migration process:

Premigration domain steps

  1. Document domain membership: Record the current domain, organizational unit (OU), and any special group memberships
  2. Note computer account: The computer account in Active Directory needs to be managed
  3. Backup domain-specific configurations: Save any domain-specific settings, group policies, or certificates

Domain removal process

  1. Remove from domain: Before deleting the original VM, remove it from the domain using one of these methods:

    • Use Remove-Computer PowerShell cmdlet on Windows
    • Use the System Properties dialog to change to workgroup
    • Manually delete the computer account from Active Directory Users and Computers
  2. Clean up Active Directory: Remove any orphaned computer accounts or DNS entries

Post-migration domain rejoining

  1. Join new VM to domain: After creating the new VM with encryption at host:

    • For Windows: Use Add-Computer PowerShell cmdlet or System Properties
    • For Linux: Use Azure AD domain join extension or manual configuration
  2. Restore domain settings: Reapply any domain-specific configurations, group policies, or certificates

  3. Verify domain functionality: Test domain authentication, group policy application, and network resource access

Linux domain joining

For Linux VMs, you can use the Azure AD Domain Services VM extension:

az vm extension set \
    --resource-group "MyResourceGroup" \
    --vm-name "MyLinuxVM-New" \
    --name "AADSSHLoginForLinux" \
    --publisher "Microsoft.Azure.ActiveDirectory"

For more information, see What is Microsoft Entra Domain Services?

Important domain considerations

  • The new VM has a different computer SID, which may affect some applications
  • Kerberos tickets and cached credentials must be refreshed
  • Some domain-integrated applications may require reconfiguration
  • Plan for potential temporary loss of domain services during migration

Post-migration verification

After completing the migration, verify that encryption at host is working correctly:

  1. Check encryption at host status: Verify that encryption at host is enabled:

    az vm show --resource-group "MyResourceGroup" --name "MyVM-New" --query "securityProfile.encryptionAtHost"
    
  2. Test VM functionality: Ensure your applications and services are working correctly.

  3. Verify disk encryption: Confirm that disks are properly encrypted:

    Get-AzDisk -ResourceGroupName "MyResourceGroup" -DiskName "MyVM-OS-New" | Select-Object Name, DiskState
    
  4. Monitor performance: Compare performance before and after migration to confirm the expected improvements.

For more information about encryption verification, see Enable end-to-end encryption using encryption at host.

Cleanup

After successful migration and verification:

  1. Delete old VM: Remove the original ADE-encrypted VM

  2. Delete old disks: Remove the original encrypted disks

  3. Update Key Vault access policies: Other disk encryption solutions use standard Key Vault authorization mechanisms. If you no longer need the Key Vault for Azure Disk Encryption, update its access policies to disable the special disk encryption setting:

    az keyvault update --name "YourKeyVaultName" --resource-group "YourResourceGroup" --enabled-for-disk-encryption false
    

  1. Clean up resources: Remove any temporary resources created during migration
  2. Update documentation: Update your infrastructure documentation to reflect the migration to encryption at host

Common issues and solutions

VM size doesn't support encryption at host

Solution: Check the list of supported VM sizes and resize your VM if necessary

VM fails to start after migration

Solution: Check that all disks are properly attached and that the OS disk is set as the boot disk

Encryption at host not enabled

Solution: Verify that the VM was created with the --encryption-at-host true parameter and that your subscription supports this feature

Performance issues persist

Solution: Verify that encryption at host is properly enabled and that the VM size supports the expected performance.

Next steps