Microsoft Azure - Troubleshooting Windows VM by attaching the OS Disk to a working repair VM in Azure Portal

Microsoft Azure, Azure VM, Troubleshooting Windows VM, OS Disk Repair,  Azure Portal

To troubleshoot Windows virtual machine in Azure that is inaccessible (e.g., due to boot issues or corruption) or sometimes, problems like a failed application update or windows updates can stop your VM from booting properly. In such cases, you can use snapshot and detach the OS, attach it to another working VM (repair VM) to troubleshoot and fix the problem. 

In this post, we will go through the steps from taking snapshot, attaching the problematic disk to a repair VM to bringing the original VM back online.  we can attach problematic OS disk to a working or repair VM and perform repair.

This method is useful when your VM fails to boot due to OS-level issues

Prerequisites:

  • Access to the Azure portal
  • Working VM or repair VM with Windows OS in the same region as the problematic VM
  • Contributor or Owner role on the subscription/resource group

Follow the steps to Troubleshoot a Windows VM by Attaching the OS Disk to a Repair VM.
  1. Identify the Problematic VM
    Go to the Azure Portal > Navigate to Virtual Machines and select the VM that is not booting. Note the resource group, location, and OS disk name.

  2. Take a Snapshot of the OS Disk
    Go to the Disks section of the VM in setting > Select the OS disk > go to Disk page > Click Create Snapshot.
    Use default settings or customize as needed, then click Review + Create.


     


  3. Create a New Disk from the Snapshot
    After the snapshot is created, go to the Snapshot resource > Click Create Disk. 
    Fill in the required details (name, resource group, region)
    > Click Review + Create.




  4. Create a Repair VM if not available
    In Azure Portal, Create a new Windows VM in the same region and resource group. 
    Choose a size and image similar to the original VM. Complete the setup and create the VM.

  5. Attach the OS Disk to the Repair VM
    Go to the Disks section of the repair VM > Click + Add data disk > Select the new disk created from the snapshot > Save the configuration.

  6. Connect to the Repair VM
    Now use RDP to connect to the repair VM. 
    Open Disk Management and bring the attached disk online if needed.
    Browse the disk to locate and fix issues (e.g., remove faulty drivers, fix or restore registry from "Regback" folder in C:\windows\System32\config\regback , etc.).

  7. Detach and Replace the OS Disk
    After repairs, detach the disk from the repair VM.
    Go to the original VM’s Disks section. Click Swap OS Disk and select the repaired disk. Save and start the original VM.


Output:
 
If the issues (boot errors, registry corruption, etc.) are resolved, the VM should start normally. If not, you can repeat the process or consider restoring from backup or using the Azure VM Repair Script.

Want in more details? checkout Microsoft Article on this.


Post a Comment

Previous Post Next Post