How to Create a Virtual Machine Connect RDP to it, Install a Web Server to it and Add a Data Disk to it
Tags: azure, cloud, virtualmachine, cloudcomputing
Published: 2023-06-12 12:32:47

**A virtual machine (VM)** is simply a digital version of a physical computer. As a virtualized instance of a computer, a virtual machine can execute almost all tasks a physical computer can, including running operating systems and applications.

**Azure Virtual Machines** are scalable, on-demand computing resources offered by Microsoft.

**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. Data disks are registered as SCSI drives and are labeled with a letter that you choose. Each data disk has a maximum capacity of 32,767 gibibytes (GiB). The size of the virtual machine determines how many data disks you can attach to it and the type of storage you can use to host the disks.

In this guide we will be creating a Windows Virtual Machine, RDP into it, install a Webserver, add a Data disk and initialise the disk and make it usable

**_Creating a Windows Virtual Machine_**

**Step 1:**
Visit [portal.azure.com](url), login or sign up if you don't have an account, you can get a free account at [azure.microsoft.com/en-us/free/](url)

**Step 2:**
On the Azure portal page **click the search box** and **enter Virtual Machine**, then **click Virtual Machine**

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

**Step 3:**
On the virtual machine page **click create button** and **select azure virtual machine**

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

**Step 4:**
_Resource Group_
**Select a resource group** or **create a new one** by **clicking create new option** shown below the input bar

_Virtual Machine Name_
**Input the Virtual Machine name** of your choice, in this example i will be using **thismyvm**

_Region_
**Select a region** where the virtual machine will be located, in this example i will be using **East US**

_Availability Option_
**Select No infrastructure redundancy required**

_Security type_
**Select Standard**

_Image_
**Select an operating system** (which is image) of your choice, in this example i will be using **Windows Server 2019 Datacenter x64 Gen2**

**VM Architecture**
**Select x64**

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

**Step 5:**
**Enter a username** which must be between 1 and 20 characters long, in this example i will be using **azureuser** as my username.
**Set a password** that the value is between 12 and 123 characters long in this example i will be using **Password123*** as my password.

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

**Step 6:**
**Set public inbound ports as Allow selected ports**.
For select inbound ports **tick HTTP and RDP**.
Then **click review + create button**

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

**Step 7:**
**Goto monitoring** and **disable Boot diagnostics**

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

**Step 8:**
**Go back to review+create tab** and **click the create button**. After clicking create the portal will start your virtual machine deployment process.

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

**_RDP into the Virtual Machine_**

**Step 1:**
After the deployment process is complete **click the Goto Resource button**

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

**Step 2:**
On the Virtual Machine page **click connect button**

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

**Step 3:**
**Click Download RDP file** and your Virtual Machine RDP file will be downloaded

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

**Step 4:**
**Goto your download folder** and **open the RDP file**, for mac users make sure you have microsoft remote desktop application installed, download and install it here: [apps.apple.com/us/app/microsoft-remote-desktop/id1295203466?mt=12](url)

**Step 5:**
**Open the RDP file** and **input your username and password** you set while creating your Virtual Machine, then click continue.

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

**Step 6:**
A prompt window will pop up **click continue**

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

**Step 7:**
Our Windows Virtual Machine is live.

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

**_Installing a Web Server to the Virtual Machine_**

**Step 1:**
On your virtual machine **go to windows search** and **type powershell**, then **select powershell** and **run as administrator**

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

**Step 2:**
On powershell **type this command:**

```
install-windowsfeature web-server
```

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

**Step 3:**
You should see this screen if you have successfully install a web server to the virtual machine

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

**Step 4:**
**Go to the overview page** of the virtual machine we created, then **copy the public IP address**

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

**Step 5:**
**Open a new tab in your browser** and **paste the IP address** we copy then hit enter

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

**Step 6:**
As you can see we have successful install a web server to our Virtual Machine

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

**_Adding a Data disk to our Virtual Machine_**

**Step 1:**
**Goto the overview page** of your virtual machine we created, then **click disk on the left**

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

**Step 2:**
**Click create and attach a new disk**

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

**Step 3:**
**Enter a data disk name** of your choice, in this example i will be using **datadisk** as my data disk name, then **enter the data disk size** of your choice, in this example i will be using **10GiB** as my data disk size, then **click save**.

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

**_Initialising the Data disk and making it Usable_**

**Step 1:**
**Go back into your Virtual Machine**, then on your windows search bar **search for disk management**, then **click create and format hard disk partitions**

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

**Step 2:**
You will see an **initialise disk pop up**, **click ok**

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

**Step 3:**
**Scroll down to disk 2**, then **right click** on it and **click New Simple Volume**

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

**Step 4:**
**Click Next**

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

**Step 5:**
**Click Next**

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

**Step 6:**
**Enter a volume label** of your choice in this guide i will be using **datadisk** as my volume label, then **click next**

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

**Step 7:**
**Click finish**

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

That will be all for this guide, thank you for reading!!!