Download a Windows VHD from Azure
Applies to: ✔️ Windows VMs
In this article, you learn how to download a Windows virtual hard disk (VHD) file from Azure using the Azure portal.
Optional: Generalize the VM
If you want to use the VHD as an image to create other VMs, you should use Sysprep to generalize the operating system. Otherwise, you will have to make a copy of the disk for each VM you want to create.
To use the VHD as an image to create other VMs, generalize the VM.
- If you haven't already done so, sign in to the Azure portal.
- Connect to the VM.
- On the VM, open the Command Prompt window as an administrator.
- Change the directory to %windir%\system32\sysprep and run sysprep.exe.
- In the System Preparation Tool dialog box, select Enter System Out-of-Box Experience (OOBE), and make sure that Generalize is selected.
- In Shutdown Options, select Shutdown, and then click OK.
If you don't want to generalize your current VM, you can still create a generalized image by first making a snapshot of the OS disk, creating a new VM from the snapshot, and then generalizing the copy.
Stop the VM
A VHD can’t be downloaded from Azure if it's attached to a running VM. If you want to keep the VM running, you can create a snapshot and then download the snapshot.
- On the Hub menu in the Azure portal, click Virtual Machines.
- Select the VM from the list.
- On the blade for the VM, click Stop.
Alternative: Snapshot the VM disk
Take a snapshot of the disk to download.
- Select the VM in the portal.
- Select Disks in the left menu and then select the disk you want to snapshot. The details of the disk will be displayed.
- Select Create Snapshot from the menu at the top of the page. The Create snapshot page will open.
- In Name, type a name for the snapshot.
- For Snapshot type, select Full or Incremental.
- When you are done, select Review + create.
Your snapshot will be created shortly, and can then be used to download or create another VM.
Note
If you don't stop the VM first, the snapshot will not be clean. The snapshot will be in the same state as if the VM had been power cycled or crashed at the point in time when the snapshot was made. While usually safe, it could cause problems if the running applications running at the time were not crash resistant.
This method is only recommended for VMs with a single OS disk. VMs with one or more data disks should be stopped before download or before creating a snapshot for the OS disk and each data disk.
Generate download URL
To download the VHD file, you need to generate a shared access signature (SAS) URL. When the URL is generated, an expiration time is assigned to the URL.
- On the page for the VM, click Disks in the left menu.
- Select the operating system disk for the VM.
- On the page for the disk, select Disk Export from the left menu.
- The default expiration time of the URL is 3600 seconds (one hour). You may need to increase this for Windows OS disks or large data disks. 36000 seconds (10 hours) is usually sufficient.
- Click Generate URL.
Note
The expiration time is increased from the default to provide enough time to download the large VHD file for a Windows Server operating system. Large VHDs can take up to several hours to download depending on your connection and the size of the VM.
Download VHD
- Under the URL that was generated, click Download the VHD file.
- You may need to click Save in your browser to start the download. The default name for the VHD file is abcd.
Next steps
Tilbakemeldinger
Send inn og vis tilbakemelding for