How to Attach a Data Disk to a Windows Virtual Machine

You can attach both empty disks and disks that contain data. In both cases, the disks are actually .vhd files that reside in an Azure storage account. Also in both cases, after you attach the disk, you’ll need to initialize it so it’s ready for use.

NOTE:
It’s a best practice to use one or more separate disks to store a virtual machine’s data. When you create an Azure virtual machine, it has a disk for the operating system mapped to the C drive and a temporary disk mapped to the D drive. Do not use the D drive to store data. As the name implies, it provides temporary storage only. It offers no redundancy or backup because it doesn’t reside in Azure storage.
• How to: Attach an empty disk
• How to: Attach an existing disk
• How to: Initialize a new data disk in Windows Server

How to: Attach an empty disk
Attaching an empty disk is the simpler way to add a data disk, because Azure creates the .vhd file for you and stores it in the storage account.
• Click Virtual Machines, and then select the appropriate virtual machine.
• On the command bar, click Attach, and then select Attach Empty Disk.
• In File Name, either accept the automatically generated name or type a descriptive name. The data disk that is created from the .vhd file will always use the automatically generated name.
• In Size, enter the size of the data disk.
• Click the check mark to attach the empty data disk.
You will now see the data disk listed on the dashboard of the virtual machine.

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 virtual machine.
• Click Virtual Machines, and then select the appropriate virtual machine.
• On the command bar, click Attach, and then select Attach Disk.
• Select the data disk that you want to attach to the virtual machine.
• Click the check mark to attach the data disk to the virtual machine.
You will now see the data disk listed on the dashboard of the virtual machine.

NOTE:
After you add a data disk, you’ll need to log on to the virtual machine and initialize the disk so the virtual machine can use the disk for storage.

How to: Initialize a new data disk in Windows Server
• Connect to the virtual machine by using the steps listed in How to log on to a virtual machine running Windows Server.
• After you log on, open Server Manager, in the left pane, expand Storage, and then click Disk Management.
• Right-click Disk 2, click Initialize Disk, and then click OK.
• Right-click the space allocation area for Disk 2, click New Simple Volume, and then finish the wizard with the default values.

The disk is now online and ready to use with a new drive letter.

 

 

Disclaimer: Many of the articles are taken from MSDN, Azure tutorials and other sources on internet to provide a single place for various information about azure development.No copyright on this information is claimed and the copyright of all information is acrrued to all original authors including MSDN and Microsoft azure training materials.Some of this information shall be outdated or incorrect and the authenticty of the information contained should be verified with changes in azure or your own environment. We do not recommend using any of this information without proper consultation.