I recently migrated some VMs to Azure for one of my Customers. VMs were in Production and the Customer was not ready to switch IP address to DHCP before migration. Unfortunately neither ASR nor MVMC was an option and I stopped on Disk2VHD tool by Mark Russinovich following PowerShell Add-AzureVHD cmdlet for the VHD upload.
To speed up the process I connected an empty virtual disk to the migrated machine and save VHD on it. After the VHD was captured by the tool I mounted it and edited registry to enable DHCP on its network adapter.
That was a mistake (I found that hard way after several hours of uploading the VHD to Azure). The VM built from the VHD failed to start. Fortunately we can now see Boot Diagnostics, so I found the VM failed with
Info: The boot selection failed because a required device is inaccessible.
Internet brought nothing about VM migration to Azure with such error
I finally found an article from Mark himself where he described exactly scenario I had (except migration to Azure). The main point – never open captured VHD on the same machine where the source disk is. That will break disk signature on VHD and it become unbootable.
Fortunately Mark described how to fix the signature.
1. Mount the VHD in Disk Manager (it should give its volumes letters since there is no signature conflict at that point)
2. Load DCD hive (located under hidden \Boot folder in root of one of the volumes) to regedit
3. Search for “Windows Boot Manager”
4. Open key 11000001 under the same elements
5. Double Click Element reg value in this key and look for Offset 0x38. We need first four bytes
6. Write down the bytes in reverse order (last byte first, third one after that, then second one and the first byte) . For example if you have four first bytes in 0x38 offset as 38 d5 5C C0 your disk signature will be c05cd538
7. Unload hive and close regedit
8. Start Diskpart tool and connect to the disk you are fixing
9. Invoke the DISKPART command: uniqueid disk id=c05cd538 (change signature to yours). At this point you should see VHD going offline in Disk Manager due to signature conflict with the source drive. This is expected, do not bring it online
10. Unmount VHD
At this point the disk signature should be fixed and disk is expected to be bootable again.