How to create and connect to a virtual machine in Azure

A virtual machine is a server (it could be Windows, Linux, or any other OSOperating System server) that you can use to install software, deploy applications, and much more in the same way that your physical machine can.

In this shot, we will discuss how we can create a Windows 10 Server and then connect to that server using Remote Desktop Connection (RDP).

Create a virtual machine in Azure

To create a virtual machine in Azure, we need to follow the below steps:

  1. Log in to your Azure Portal.

  2. Select Create a Resource and then select the Compute option, as shown below.



  1. Select Virtual machine from the above options.

  2. Fill in the details, as shown below.


  1. Select your subscription.

    • This is the resource group that you want your virtual machine to be in.
  2. In Instance details, enter a name for your virtual machine.

  3. Select the region where you want your virtual machine to be located.

  4. Select the image of the virtual image. The image is the operating system of your virtual machine.

  5. Select the size of your virtual machine. This means how much vCPUs and RAM is required. Accordingly, you will see the price.

  6. Inside Administrator account, enter the username and password that you will use while logging in to the virtual machine. (Note them down somewhere if you want to).

  7. In Inbound port rules, we will allow port 3389, as this is the port through which RDP sessions work.

  8. Once you feel all the settings are fine, click on the Review + Create button and finally click on the Create button.


You may need to wait for some time to get the virtual machine and all other components (like the network card and the disk for the virtual machine) to be created.


  • Once created, you can select the Go to resource button, as shown in the snapshot below.

Now that the virtual machine is set up, let’s see how to connect to it.

Connect to the virtual machine using RDP

To connect to the virtual machine, go to your virtual machine resource and follow the below steps:

  1. Select the Connect option.


  1. Then select Download RDP File. This will download a file.

  2. Open the file you just downloaded, and Connect to your virtual machine using the username and password that we set in a previous step to login to the machine.

  3. You can now access a freshly created virtual machine remotely.

In this way, we can spin up the virtual machines very easily and shut them down when required.


If you are not using the virtual machine, please shut it down or delete the resource to avoid a high cost.


Check out my course Build a REST API Using Python and Deploy it to Microsoft Azure for additional information on Microsoft Azure services.


Free Resources