Creating Azure Virtual Machine: A Step-by-Step Guide for Beginners
Tags: azure, cloudcomputing, virtualmachine, beginners
Published: 2023-07-22 12:49:51

**New to Cloud Computing**
You can go [this article](https://dev.to/princemaxi/cloud-computing-technologys-best-friend-1i4a) to understand the basics.

## What is a Virtual Machine?

Imagine you have a physical computer, like a laptop or a desktop. A virtual machine is like a computer inside your computer. It's a software emulation of a physical computer that runs on your existing hardware. A virtual machine provides a completely isolated and separate environment from your physical computer. You can run different operating systems and applications on a virtual machine without affecting your host computer. For example, if you have a Windows computer, you can create a virtual machine that runs Linux, and vice versa. They are highly flexible. You can create multiple virtual machines on a single physical computer, each with its own operating system and applications. This allows you to have different environments for different purposes, such as testing software, running older applications, or experimenting with new configurations. 

These are the basic concepts of virtual machines. It's worth noting that there are different virtualization technologies available, such as VMware, VirtualBox, and Hyper-V or cloud computing service like Azure each with its own specific features and capabilities. The choice between using a VM software like VMware or a cloud computing service like Azure depends on your specific needs and requirements. If you want to run OS-specific software, such as ROS (Robot Operating System) in Ubuntu, on your laptop or desktop, using a VM software like VMware is a great option. It allows you to create a virtual machine with the desired operating system and run the software within that isolated environment. This gives you the flexibility to use the software whenever you need it, without impacting your host operating system. On the other hand, if you have a requirement where you need to run something, like a server for your website, 24 hours a day throughout the year, using a cloud computing service like Azure can be a better choice. 

Cloud computing services provide infrastructure and resources that are available and accessible over the internet. With Azure, you can create and manage virtual machines in the cloud, ensuring that your server remains up and running continuously, even if your local machine is turned off.

## Azure Virtual Machines

Azure Virtual Machines are a service offered by Microsoft Azure that allows you to create and run virtual machines in the cloud. They provide flexibility in terms of operating systems and machine sizes, scalability to adjust resources as needed, and a pay-as-you-go pricing model. Azure VMs can be integrated with other Azure services, offer high availability and reliability, and can be managed and automated using various tools. Overall, Azure VMs provide the flexibility, scalability, and management options required for different workload requirements.

Also, Azure provides additional services such as system diagnostics to monitor your VM, excellent security options, and the ability to manage updates and patches to your operating system.

## Requirements for Using Azure
The basic requirement to access the [Azure portal](https://portal.azure.com/) is an Azure Account. These are the types of subscriptions you could typically get:

- [Azure Subscription](https://azure.microsoft.com/en-us/free/search/?ef_id=_k_Cj0KCQjwk96lBhDHARIsAEKO4xZaYLt7llV_dZ-KWjnR3_en3mNR38xdfUuBPSqEDrMX7fahK58YP-EaAj8vEALw_wcB_k_&OCID=AIDcmmfdukp5kz_SEM__k_Cj0KCQjwk96lBhDHARIsAEKO4xZaYLt7llV_dZ-KWjnR3_en3mNR38xdfUuBPSqEDrMX7fahK58YP-EaAj8vEALw_wcB_k_&gclid=Cj0KCQjwk96lBhDHARIsAEKO4xZaYLt7llV_dZ-KWjnR3_en3mNR38xdfUuBPSqEDrMX7fahK58YP-EaAj8vEALw_wcB)
- [Azure Student Subscription](https://azure.microsoft.com/en-us/free/students)

The difference lies in the type of subscription you choose based on your status as a student or a non-student.

**Student Subscription:**

For students, Azure offers a special Student Subscription that is completely free of charge. Students can easily access the Azure platform by providing details about their college or university.
To simplify the process, students are encouraged to use their official college/school email IDs (e.g., .edu email accounts) for registration. With the Student Subscription, students can access Azure services without any cost during their academic period.

**Azure Subscription:**

If you are not a student, you can still sign up for Azure using the regular Azure Subscription. This subscription is also free, Azure will give free $200.00 for the first one month and allow you use some services free for 12 months which allows users to explore and use Azure services without immediate charges. However, when signing up for the Azure Subscription, you are required to provide your credit card details. After the initial free period ends, Azure will not charge you unless you choose to upgrade for a paid subscription or use services that incur charges.

## Azure Virtual Machine Component
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3ikkbesx0nb7g98ol2a.png)

The major component of an azure virtual machine are:
1. Resource Group
2. Vm size
3. Virtual Network
4. Images [Ubuntu/Windows]
5. Virtual Disk [ Storage ]

## How to Create an Azure Virtual Machine
There are four ways to create a VM(resource) on Azure:
1. Azure Portal
2. Azure CLI
3. Azure PowerShell[Az Module]
4. Azure ARM Templates

## Deploying a Virtual Machine in Microsoft Azure on Azure Portal
In cloud computing the term deploying means creating and configuring a resource, here are steps to create and configure a Windows Virtual Machine on Azure cloud.

_Just a quick note: I have highlighted the areas you might need to click on with green rectangles. To make navigation easier, I have also included screenshots of the entire process._

- Go to the [Azure portal](https://portal.azure.com/) and click on "Create a resource" on the homepage.

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

- You are now in the Azure Marketplace where you can access and create resources based on your project, just like the highlighted virtual machine.

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

- Since we want to deploy the Windows 11 VM, search for it on the search bar once it displays as seen below tap the Enter button.

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

- Read the information displayed carefully and select out of the options from the dropdown menu the version of Windows 11 you want to deploy, in this article we are deploying the Windows 11 Pro, version 21H2 and enter the create button.

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

- You have now been redirected to the configuration page for your VM, select your subscription.

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

- Click on the "Create new" to create a resource group(RG) for your VM, enter any desired name for your RG and click on "OK"

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

- Give your VM a name just like I did name mine "myVM", while naming your VM note it doesn't accept any special character. From the drop down chose your region, it is important you select your region carefully because they differ in features and ensure you select a region that is closer to your customer to ensure low latency(high connectivity), I will go with West Europe for now because its closest to my customer here in Nigeria. I selected my security type to standard which is the basic security, you can select other options based on your project. Leave the image on default.

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

- Use the drop down to select the memory size of your VM, your memory size depends on the purpose of your VM. Here we use the standard d2s v3 2 vCPUs 8 gib memory which is for general purpose. You can use other series if you have need for cheaper services or higher memory like the M-series are used for larger databases because of the high vCPU count and large amount of memory they possess, if you're new to Azure I suggest you go for the B1ls which is best for small web servers and databases.

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

- Next is our authentication field, To set up authentication for the Virtual Machine (VM), choose the "password" method and create a username and password for the user. Prioritize security by selecting a strong password with a mix of uppercase and lowercase letters, numbers, and special characters. Replace "myusername" with the desired username and choose a unique and secure password to replace "MyP@ssw0rd!". Remember to store the password securely and avoid sharing it openly. Implement good security practices, including regular password changes and avoiding easily guessable information.

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

- Under the "Public inbound ports" option, select "Allow selected ports." Then, choose "RDP (3389)" for the "Select inbound ports" field. This configuration will keep port 3389 open, allowing you to access the Virtual Machine (VM) through Remote Desktop Protocol (RDP) once it is deployed. RDP enables you to remotely connect to the VM's desktop interface and manage it as if you were sitting in front of the machine. It is commonly used for Windows-based VMs. After the deployment, you can use an RDP client (such as "Remote Desktop Connection" on Windows or "Microsoft Remote Desktop" on macOS) to connect to your VM using its public IP address or hostname, along with the appropriate username and password for authentication.

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

- Next check the "licensing" checkbox before you proceed, When deploying a Windows VM on Azure, it's crucial to check licensing requirements and compliance for several reasons. Firstly, using unlicensed software is illegal and can lead to severe legal consequences and financial penalties. Proper licensing ensures access to updates, security patches, and support from Microsoft, reducing security risks. Azure offers both Azure-provided licenses and Bring Your Own License (BYOL) options, and staying updated on Microsoft's licensing terms is essential to ensure full compliance.

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

- Select the "Next: Disks" option at the bottom of the page.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nx2sx9skaty2tk8co63r.png)

- On the Disk interface, as a beginner just change only the operating system(OS) disk parameter from the default parameter which is Premium SSD which will cost you more though it has a better performance but we don't need it now, you changed it from the dropdown menu to Standard SSD(locally-redundant storage).

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

- Select the "Next: Networking" option at the bottom of the page.

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

- On the networking interface, you will see that your "virtual network", "subnet" and "public IP" has been generated automatically by the system and you can see the inbound parts we selected earlier has been set to RDP(3389). All parameters here should be left on default.

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

- Select the "Next: Management" option at the bottom of the page to continue.

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

- Allow all parameters on default on the management interface and select the "Next: monitoring" option at the bottom of the page.

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

- Leave all parameters on default and proceed to "Next: Advanced" option at the bottom of the page.

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

- Also allow all parameters should be left on default at this "Advanced" interface and select the "Next: Tags" option at the bottom of the page to proceed.

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

- "Tags" refer to a feature that allows users to apply metadata to resources like virtual machines, storage accounts, databases, and more within their Azure environment. Tags are represented as name-value pairs and provide a way to categorize and organize resources based on custom attributes. You can add multiple tags when deploying your virtual machine, here we customized two tags; one specify our auto shutdown time the other the purpose of our VM.

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

- At this point we are done with the configuration of our VM, select the "Next: Review + Create" option at the bottom of the page.

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

- Azure automatically validates your VM configuration, once Azure finish validating your VM it will let you know if your VM passed or failed with an error message, If your VM passed validation you can view the cost of your VM and summary of your configuration options. Once you finish cross checking your configuration click on the "Create" option at the bottom of the page.

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

- Your VM will now enter into the deployment process and should be ready in few minutes, you can also check your VM deployment status on the notification tab.

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

- Congratulations! you just created an Azure Virtual Machine.

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

- You can now click on "Go to Resource" to access your newly created VM.

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

- This is how it looks.

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

To proceed further with what you have learnt, you can learn how to connect your VM to an RDP established connection.

After you are done using your VM do not forget to stop your VM so that you don't get billed the time its not in use or you can set an auto-shutdown time which enables it to shutdown automatically at a set time.




_If you like this article, stay tuned for more..._