Share via

Can't connect to VM after migrating to azure

Chad Miller 80 Reputation points
2026-03-08T14:53:47+00:00

Issue Summary We are attempting to create a working Azure VM from an existing managed OS disk. The VM boots successfully to the Windows login screen (visible in Boot Diagnostics), but we cannot connect via RDP and Azure management features are not functioning. This existing disk was restored from Veeam backup. It was restored as a vm gen1. I ran azure cli command to change the vm generation from v1 to v2. Environment Azure Virtual Machine (Windows) OS Disk: Managed Disk (Premium SSD) Hyper-V Generation: Gen2 Disk Partition Style: GPT VM created from an exported Azure managed disk Current Problem The VM successfully boots and the Windows login screen is visible in Boot Diagnostics, but: RDP fails with: “Remote Desktop can't connect to the remote computer.” Run Command in the Azure portal hangs indefinitely. Reset Configuration also hangs. Portal indicates the VM Agent is unavailable or not installed. Serial Console shows a black screen after boot. This suggests the Azure VM Agent is not present or not functioning, preventing Azure from interacting with the VM. Troubleshooting Performed Verified Disk Configuration Disk is already GPT and supports Gen2. VM can boot successfully from the disk. Recreated the VM Recreated the VM using the same OS disk. Same behavior occurs. Checked Boot Files Verified bootx64.efi exists under the EFI boot directory. Exported Disk Exported the managed disk as a VHD from Azure. Attempted Disk Repair via Repair VM Created a temporary repair VM. Attached the OS disk as a data disk. Attempted fixes including: Resetting network interface registry keys. Installing the Azure VM Agent onto the offline disk. Creating the WindowsAzure folder (which was missing). Detached the disk and recreated the VM. Result VM still boots normally. RDP still fails. Azure VM Agent still appears unavailable. Additional Observations The WindowsAzure directory did not exist on the OS disk. The VM appears functional at the OS level but Azure cannot communicate with it. Boot Diagnostics confirms the system reaches the Windows login screen. Assistance Requested We need help determining: Why the Azure VM Agent is not functioning or registering when creating a VM from this disk. Whether there is missing Azure fabric metadata or another requirement when creating a VM from an exported managed disk. The correct process to restore full Azure VM functionality (RDP, Run Command, VM Agent) using this existing OS disk.

Azure Migrate
Azure Migrate

A central hub of Azure cloud migration services and tools to discover, assess, and migrate workloads to the cloud.


Answer accepted by question author
  1. Naveena Patlolla 9,310 Reputation points Microsoft External Staff Moderator
    2026-03-13T14:18:15.99+00:00

    Hi Chad Miller
    To repair the Windows VM, we followed the Microsoft guidance using the Azure Virtual Machine Repair extension. First, we configured the subscription and installed the VM repair extension using the following Azure CLI commands: https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/windows/repair-windows-vm-using-azure-virtual-machine-repair-commands

    az account set --subscription "SubID" 
    az extension add -n vm-repair 
    az extension update -n vm-repair 
    

    Next, we created a repair VM and attached the OS disk of the affected VM using the following command:

    az vm repair create -n magixbox-test-win -g Rescue-vm --enable-nested --verbose 
    

    After the repair VM was created, we executed the repair operation:

    az vm repair run -g Rescue-vm -n magixbox-test-win --run-on-repair --run-id win-hello-world --verbose 
    

    follow the steps provided in the Microsoft documentation for installing the Azure VM Agent in offline mode. https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/windows/install-vm-agent-offline#step-2-modify-the-os-disk-to-install-the-azure-vm-agent

    During this process, the system hive from the faulty disk was loaded in Registry Editor, and the required services were verified and updated.

    The following registry paths were checked and updated for the Azure VM Agent services: HKEY_LOCAL_MACHINE\BROKENSYSTEM\ControlSet001\Services\WindowsAzureGuestAgent HKEY_LOCAL_MACHINE\BROKENSYSTEM\ControlSet001\Services\RdAgent

    These changes ensure that the WindowsAzureGuestAgent and RdAgent services start correctly when the VM boots.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.