How to generate Azure VM OS VHD from on-premises Windows Disk using Powershell?

Siegfried Heintze 1,906 Reputation points
2023-01-03T22:23:31.817+00:00

Please point me to the documentation for creating an Azure VM (and OS VHD) from an on-premises Windows boot disks.

I need to understand how to accomplish this with on premises

  1. physical disks
  2. dynamic VHD
  3. VHDX

Thanks

Siegfried

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,034 questions
0 comments No comments
{count} votes

Accepted answer
  1. srbhatta-MSFT 8,586 Reputation points Microsoft Employee
    2023-01-04T06:42:58.593+00:00

    Hello @Siegfried Heintze ,
    Welcome back to Microsoft QnA.
    To create an Azure Virtual Machine (VM) with an operating system (OS) VHD from an on-premises Windows disk, you will need to perform the following steps:

    1.Prepare the on-premises disk:
    a)If you are using a physical disk, you will need to attach it to a Windows server and create a VHD of the disk using the Disk Management tool or PowerShell.
    b)If you are using a dynamic VHD or VHDX file, you will need to ensure that it is properly configured and contains a bootable Windows installation.
    2.Upload the VHD to Azure:
    a)You will need to use the Azure Storage Service to upload the VHD to a storage account in Azure. You can use Azure PowerShell, Azure CLI, or the Azure portal to do this.
    3.Create the Azure VM:
    a)Once the VHD is uploaded to Azure, you can use Azure PowerShell, Azure CLI, or the Azure portal to create a new VM and attach the VHD as the OS disk.

    For detailed instructions on how to perform these steps, you can refer to the following Microsoft documentation:

    1. Prepare a Windows VHD or VHDX to upload to Azure
    2. Upload a generalized Windows VHD and use it to create new VMs in Azure and Upload a VHD to Azure or copy a managed disk to another region - Azure PowerShell
    3. Create a VM from a managed image

    The above documentations belong to the same parent doc, and provides each step in detail. Hope this helps.

    ------------

    Please accept as answer and upvote if the above information is helpful.


0 additional answers

Sort by: Most helpful

Your answer

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