Creating a Windows Virtual Machine in Azure: Step-by-Step Guide
Tags: webdev, tutorial, beginners, devops
Published: 2023-08-13 19:29:41

## **What is a Virtual Machine?**

_A virtual machine (VM) is a software-based emulation of a physical computer that runs an operating system and applications. It operates within a host system and allows multiple VMs to run on a single physical machine, enabling efficient resource utilization and isolation for various tasks and environments._


On the Azure Portal at www.portal.azure.com 


Step 1: _Search for Virtual Machine_

![Search for Virtual Machine](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/umkarabze5st7tgacj5p.png)

Step 2: _Click Virtual machine_

![Click Virtual machine](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rs1kdayk2nr84upjwgt3.png)

Step 3: _Click Create_



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


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

Step 4: _Click Azure Virtual machine_

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

_Step5:Create a new Resource Group for the Virtual Machine._

_A resource group in Azure is a logical container that holds related Azure resources, such as virtual machines, storage accounts, and networking components. It helps in organizing, managing, and monitoring resources collectively within a project or application._

_For better understanding, use a school setting to illustrate Azure, Resource group, and Virtual machine; In the school (Azure), classrooms are resource groups, each holding subject-related items. A student's desk symbolizes a virtual machine where various tasks are done by the students._

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

Step 6: _Assign a preferred name to the Resource Group_

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


Step 7: _Assign a preferred name to the Virtual machine_
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/isd85xgh75sddbd50nft.png)

Step 8: _Select a preferred Region for the Virtual Machine._

_An Azure region is a geographic area containing multiple data centers that host Microsoft Azure cloud services, enabling efficient and reliable global access to computing resources and data storage._

_Think of a school campus as an Azure region, with multiple buildings representing data centers. Within each building (data center), there are classrooms symbolizing resource groups, where related subjects' materials are kept together._

_Inside a classroom (resource group), you have desks with computers like virtual machines. These virtual machines are like students' personal workstations, allowing them to perform tasks without needing physical computers. Just as the school campus spans a large area, an Azure region covers a geographic area to offer services globally._

**_Microsoft Azure has over 60 regions worldwide._**

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

Step 9: Deploy the Virtual machine in an Availability Zone.

_An Azure availability zone is a physically separate data center within an Azure region, providing fault tolerance by ensuring applications remain available and resilient to failures within a region._

_Imagine a university as Azure, with buildings as regions. Each building houses classrooms as availability zones. The campus represents a large-scale system, Azure, with classrooms safeguarding against failures like availability zones in data centers._

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

Step 10: _Under images, select the images draw-down box_

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

Step 11: _Under images, select the Windows Server 2019 Datacenter x64 Gen2_

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

Step 12: _Create the Administrator Account; with the username and password._

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

Step 13: _Configure the inbound Port rules. Click on Allow select port under Public inbound ports._

_In Azure, checking "Allow inbound port" under public inbound ports means that incoming network traffic to the specified port on a virtual machine (VM) or resource will be permitted. This setting allows external connections to reach the resource through the specified port, potentially exposing it to the internet. It's crucial to configure this carefully to ensure security by only allowing necessary and safe connections._

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

Step 14: _Inbound port must be specified. Select the draw-down on the inbound ports box._
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4axn5dxgahh1rx6w1n2f.png)

Step 15: _Check the RDP(3389) and HTTP(80)_

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

**What are the implications of checking RDP and HTTP while spinning off a Virtual Machine?**

_Checking the ** RDP (Remote Desktop Protocol) port (3389)** and the ** HTTP port (80)** on the inbound settings of an Azure virtual machine has the following implications:_

_**RDP (Port 3389):** Enabling RDP allows remote access to the virtual machine. This is useful for administrators to manage and configure the virtual machine. However, it also presents a security risk if not properly secured. Unauthorized users could attempt to gain access to the virtual machine if security measures are not in place, potentially leading to data breaches or malicious activities._

**HTTP (Port 80):** _Enabling port 80 allows incoming web traffic, commonly used for serving websites or web applications. It's crucial to ensure the hosted application is properly secured against common web vulnerabilities like cross-site scripting (XSS) or SQL injection, as well as data breaches or unauthorized access._

When enabling these ports, implement the following security practices:

**Strong Credentials:** Use strong, complex passwords or consider using SSH keys for remote access.
**Network Security Groups (NSGs):** Configure NSGs to restrict access to only necessary IP addresses or ranges.
**Firewalls:** Set up firewalls on the virtual machine itself to allow only authorized IPs.
**Regular Updates:** Keep the virtual machine's operating system and applications updated with security patches.
**HTTPS (for HTTP):** If hosting a website, consider using HTTPS (port 443) to encrypt traffic and ensure data privacy.
**Monitor Logs:** Regularly monitor logs for any unusual activity.

It is very important to always prioritize security when exposing services to the internet, and consider using Azure services like Azure Bastion or VPNs for secure remote access._

Step 16: Click on **"Monitoring"** and **disable boot diagnostics**. 

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

Incorporating monitoring during virtual machine creation establishes a proactive approach to maintenance, security, and performance, contributing to a more reliable and optimized IT environment.


Step 17: Disable the **boot Diagnostics**


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

Disabling boot diagnostics, a feature that captures screenshots and logs during a virtual machine's boot process, might be necessary in specific situations:

**Security:** Boot diagnostics can potentially capture sensitive information during the boot process, posing security risks if not managed properly.

**Privacy:** Sensitive data could be inadvertently captured in screenshots or logs, violating privacy regulations and policies.

**Resource Usage:** Enabling boot diagnostics consumes storage space and processing resources, impacting performance and incurring unnecessary costs.

**Debugging:** In some scenarios, boot diagnostics might not be needed for troubleshooting or debugging, making it redundant.

**Customization:** Boot diagnostics may interfere with custom boot processes or scripts that need to run without external interference.

**Temporary Scenarios:** For temporary instances or testing environments, boot diagnostics might not provide significant value.

Step 18: Click on **Review and Create**


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

Step 19: _After Validation passed, click on Create to deploy the Virtual machine_

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



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


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

Step 20: After deployment, click on **Go to resource**


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

Step 21: Click on the **"Connect"** function.


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

In the context of Azure or virtual machines, the "Connect" function usually refers to connecting to a virtual machine (VM) for remote management and administration. 

This can be achieved using technologies like Remote Desktop Protocol (RDP) for Windows VMs or SSH (Secure Shell) for Linux VMs.

The purpose of the "Connect" function is to provide users with a way to access and manage their virtual machines remotely. 

This is particularly useful when you need to perform tasks on a VM without being physically present at the machine. 

By utilizing the "Connect" feature, you can effectively manage and maintain your virtual machines in a convenient and secure manner.


Step 22: _Download Remote Desktop Protocol (RDP) to connect the 
virtual machine (VM) for remote management and administration._


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

Step 23: Save the Downloaded RDP file on the local PC



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

Step 24: Click on the RDP file and input the Administrator's Account details


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


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


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

 
Step 25: Finally Launch the Virtual machine


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

Congratulations on the successful launch of your virtual machine! 

With this accomplishment, you've unlocked new possibilities for scalability, flexibility, and efficiency in your operations. Remember to continuously monitor, secure, and optimize your VM to ensure it performs at its best. Embrace the power of technology to drive your goals forward. 

Best of luck on your journey ahead!


**_Just Sharing the little I knew with the co-greenhorns on Cloud!_**