Attach a data disk to a Windows virtual machine created with the classic deployment model


Azure has two different deployment models for creating and working with resources: Resource Manager and Classic. This article covers using the Classic deployment model. Microsoft recommends that most new deployments use the Resource Manager model. If you want to use the new portal, see How to attach a data disk to a Windows VM in the Azure portal.

If you need an additional data disk, you can attach an empty disk or an existing disk with data to a VM. In both cases, the disks are .vhd files that reside in an Azure storage account. In the case of a new disk, after you attach the disk, you'll also need to initialize it so it's ready for use by a Windows VM.

For more details about disks, see About Disks and VHDs for Virtual Machines.

Attach an empty disk

Attaching an empty disk is a simple way to add a data disk, because Azure creates the .vhd file for you and stores it in the storage account.

  1. Click Virtual Machines, and then select the appropriate VM.
  2. On the command bar, click Attach, and then click Attach Empty Disk.

    Attach an empty disk

  3. The Attach an Empty Disk dialog box appears.

    Attach a new empty disk

    Perform the following steps:

    • In File Name, accept the default name or type another one for the .vhd file. The data disk uses an automatically generated name, even if you type another name for the .vhd file.
    • Type the Size (GB) of the data disk.
    • Click the check mark to finish.
  4. After the data disk is created and attached, it's listed in the dashboard of the VM.

    Empty data disk successfully attached


After you add a data disk, you need to log on to the VM and initialize the disk so that it can be used.

How to: Attach an existing disk

Attaching an existing disk requires that you have a .vhd available in a storage account. Use the Add-AzureVhd cmdlet to upload the .vhd file to the storage account. After you've created and uploaded the .vhd file, you can attach it to a VM.

  1. Click Virtual Machines, and then select the appropriate virtual machine.
  2. On the command bar, click Attach, and then select Attach Disk.

    Attach data disk

  3. Select the data disk and then click the check mark to attach the data disk.

    Enter data disk details

  4. After the data disk is attached, it's listed in the dashboard of the VM.

    Data disk successfully attached

Initialize the disk

  1. Connect to the virtual machine. For instructions, see How to log on to a virtual machine running Windows Server.
  2. After you log on to the virtual machine, open Server Manager. In the left pane, select File and Storage Services.

    Open Server Manager

  3. Expand the menu and select Disks.
  4. The Disks section lists the disks. In most cases, it will have disk 0, disk 1, and disk 2. Disk 0 is the operating system disk, disk 1 is the temporary disk, and disk 2 is the data disk you just attached to the VM. The new data disk will list the Partition as Unknown. Right-click the disk and select Initialize.
  5. You're notified that all data will be erased when the disk is initialized. Click Yes to acknowledge the warning and initialize the disk. Once complete, the Partion will be listed as GPT. Right-click the disk again and select New Volume.
  6. Complete the wizard using the default values. When the wizard is done, the Volumes section lists the new volume. The disk is now online and ready to store data.

    Volume successfully initialized


The size of the VM determines how many disks you can attach to it. For details, see Sizes for virtual machines.

Additional resources

How to detach a disk from a Windows virtual machine

About disks and VHDs for virtual machines