Create a Windows virtual machine in the Azure portal
Tags: azure, virtualmachine, rdp, microsoftcloud
Published: 2024-05-10 13:30:52

In this blog, you will learn to deploy a simple virtual machine, open a network port for web traffic, and install a basic web server.

Applies to: ✔️ Windows VMs

Azure virtual machines (VMs) can be created through the Azure portal. This method provides a browser-based user interface to create VMs and their associated resources. This quickstart shows you how to use the Azure portal to deploy a virtual machine (VM) in Azure that runs Windows Server 2019. To see your VM in action, you then RDP to the VM and install the IIS web server.

If you don't have an Azure subscription, create a free account before you begin.

Step 1: Sign in to the Azure portal.
Step 2: Create virtual machine

- Enter virtual machines in the search.

- Under Services, select Virtual machines.

- In the Virtual machines page, select Create and then Azure virtual machine. The Create a virtual machine page opens.

- Under Instance details, enter myVM for the Virtual machine name and choose **Windows Server 2022 Datacenter - x64 Gen 2** for the Image. Leave the other defaults.

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

- Under Administrator account, provide a username, such as azureuser and a password. The password must be at least 12 characters long and meet the defined complexity requirements.

![User and password](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1z3vx6ezvcn3t1x14o3.png)

- Under Inbound port rules, choose Allow selected ports and then select RDP (3389) and HTTP (80) from the drop-down.

![Inbound port rule](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/onpk63xasmfg3caosgn3.png)

- Leave the remaining defaults and then select the Review + create button at the bottom of the page.

![Review and create](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ihyjqdpr8cuqemhbkjj.png)

- After validation runs, select the Create button at the bottom of the page.

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

- After deployment is complete, select Go to resource.

![gotoresource](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pg1uqh9dbvetcnst0jwb.png)

Step 3: Connect to virtual machine
Create a remote desktop connection to the virtual machine. These directions tell you how to connect to your VM from a Windows computer. On a Mac, you need an RDP client such as this Remote Desktop Client from the Mac App Store.

- On the overview page for your virtual machine, select the Connect > RDP.

![RDP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5e96hdrj5l5l9hpcz9pu.png)

- In the Connect with RDP tab, keep the default options to connect by IP address, over port 3389, and click Download RDP file.

![Download RDP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fzttrwr139yemvmi49bw.png)

- Open the downloaded RDP file and click Connect when prompted.

- In the Windows Security window, select More choices and then Use a different account. Type the username as localhost\username, enter the password you created for the virtual machine, and then click OK.

- You may receive a certificate warning during the sign-in process. Click Yes or Continue to create the connection






Note: Clean up resources
Delete resources when no longer needed, you can delete the resource group, virtual machine, and all related resources.

On the Overview page for the VM, select the Resource group link.

At the top of the page for the resource group, select Delete resource group.

A page will open warning you that you are about to delete resources. Type the name of the resource group and select Delete to finish deleting the resources and the resource group.