ATTACHING A MANAGED DATA DISK TO AN AZURE WINDOWS VIRTUAL MACHINE
Published: 2023-06-17 12:14:23

**This article presents steps that are required to successfully attach a managed data disk to a Windows Virtual Machine using the Azure portal.**

To achieve this, two major tasks need to be accomplished.
**1. Create and attach a data disk**
**2. Initialize the new data disk**

**What is a data disc, and why is it important in computing?**
A data disk is a managed disk that's attached to a virtual machine to store application data, or other data you need to keep.
Azure managed disks are block-level storage volumes that are managed by Azure and used with Azure Virtual Machines.

The available types of data disks are **ultra disks**, **premium solid-state drives (SSD)**, **standard SSDs**, and **standard hard disk drives (HDD)**.

Managed disks come with many benefits such as **high durability and availability**, **Simple and scalable**, **integration with availability sets**, **integration with Availability Zones**, enjoys **Azure Backup support** and **Azure Disk Backup**.

**STEP 1: CREATE AND ATTACH A DATA DISK**

- 
Sign in to the **Azure portal**.

- 
Search for and select **Virtual machines**.

- 
Select a virtual machine from the list.

- 
On the Virtual machine pane, select **Disks**.

- 
On the Disks pane, select **Create and attach a new disk**.

- 
In the drop-downs for the new disk, make the selections you want, and name the disk.

- 
Select **Save** to create and attach the new data disk to the VM.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yf1dzvd3feitnur5c3mp.PNG)

The disk is created and attached to the VM!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ofz49vcxi5k2ikksiqrz.PNG)

**STEP 2: INITIALIZE THE NEW DATA DISK**

- 
**Connect to the VM**.
Go to the VM overview and click on connect. Then click on **Download RDP File** to download connecting details to your desktop.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56qq5boj0f43omg8vm7a.PNG)

- 
Go to downloads and double-click on the file to run. The remote desktop connection prompt will pop-up. Click connect.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1135fcd5z35aqgelht7.PNG)

Windows security will pop-up, requesting for your credentials. 

- 
Enter the Username and Password of your virtual machine.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkijbid5qz9f00km6xkm.PNG)
This will remotely connect you to your virtual machine.


_**In the Virtual Machine!**_
- 
Select the Windows Start menu inside the running VM and enter diskmgmt.msc in the search box. The Disk Management console opens.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/piaf2n872qe557reupoh.jpg)

Disk Management recognizes that you have a new, uninitialized disk and the Initialize Disk window appears.

- 
Verify that the new disk is selected and then select **OK** to initialize it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u6td5z7cylmx39viajxy.jpg)

The new disk appears as unallocated. 

- 
Right-click anywhere on the disk and select **New simple volume**. The New Simple Volume Wizard window opens.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/01l5em5b1nf6svhrp40w.jpg)

- 
Proceed through the wizard, keeping all of the defaults, and when you're done select Finish.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dh41oz9xqaqkugymlu4x.png)

- 
Close **Disk Management**.

A pop-up window appears notifying you that you need to format the new disk before you can use it. Select Format disk.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ev0cj7z09kdl3fha43xw.png)

In the Format new disk window, check the settings, and then select Start.
A warning appears notifying you that formatting the disks erases all of the data. Select **OK**.

When the formatting is complete, select **OK**.

**Data disk healthy and ready for use**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lrj7kcfrfdehw2i1jwrn.png)

**The data disk on the virtual desktop**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dq8w180z42gyahwetuex.png)

**The data disk on the VM in Azure portal**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q2nw0bx5y3gkw4fwpr3g.PNG)

_Hope this is simple enough._