DEV Community

Cover image for Deploying and Configuring a Windows Server Virtual Machine on Azure
Oladosu Ibrahim
Oladosu Ibrahim

Posted on

Deploying and Configuring a Windows Server Virtual Machine on Azure

Introduction

Azure makes it seamless to deploy and manage Windows Server Virtual Machines (VMs) in the cloud. With just a few clicks, you can spin up a secure, scalable Windows Server environment that supports web hosting, enterprise applications, or administrative testing.

In this guide, we’ll walk through:

  • Creating and configuring a Windows Server VM (WS-VM1).
  • Securing access with RDP and HTTP rules.
  • Connecting to the VM via Remote Desktop.
  • Installing and configuring IIS as a web server.

By the end, you’ll have a fully deployed Windows Server 2022 VM running in Azure, configured to serve web content.

Skilling Objectives

  • Deploy a Windows Server 2022 Datacenter VM in Azure.
  • Configure networking rules for secure remote access.
  • Connect to the VM using RDP.
  • Install and test Internet Information Services (IIS).

Step 1: Create the Windows Server VM

💡 What is a Windows Server VM?
A Windows Server VM is a cloud-hosted instance of Microsoft’s enterprise server OS. It provides a flexible way to run workloads without relying on physical hardware.

Steps:

  1. In the Azure Portal, search for Virtual Machines and select it.
    Image 1

  2. Click + Create → Azure Virtual Machine.
    Image 2

  3. On the Basics tab, configure the following settings:

Property Value
Subscription Your subscription
Resource Group rg-alpha
VM Name WS-VM1
Region East US
Availability options No infrastructure redundancy required
Security type Standard
Image Windows Server 2022 Datacenter: Azure Edition – x64 Gen2
VM architecture x64
Size Standard_D4s_v3 (4 vCPUs, 16 GiB memory)
Admin Username prime
Password P@ssw0rdP@ssw0rd (choose a secure password in real deployments)
Inbound Ports RDP (3389)
  1. Click Review + Create → Create.
    Image 3
    Image 4
    Image 5

  2. Wait for the deployment to complete, then select Go to resource.
    Image 6

Step 2: Configure Networking Rules

💡 Why configure networking?
By default, Azure VMs allow broad access. Restricting and fine-tuning inbound rules ensures better security.

Steps:

  1. From the WS-VM1 resource page, go to Networking.
    Image 7

  2. Under inbound rules, locate the RDP rule.

  • Change the Source to My IP address.
  • Click Save.

✅ This ensures that only your current IP can access the VM via Remote Desktop.
Image 8
Image 9

  1. Next, add an inbound port rule for HTTP:
  • Click Add inbound port rule.
  • Configure the rule as follows:
Property Value
Source Any
Source port ranges *
Destination Any
Service HTTP
Action Allow
Priority 310
Name AllowAnyHTTPInbound
  1. Click Add to apply the rule. Image 10 Image 11

Step 3: Connect to the VM via RDP

💡 Why use RDP?
Remote Desktop Protocol (RDP) lets you log in to your Windows Server VM just like a physical server.

Steps:

  1. From the WS-VM1 page, click Connect → RDP → Download RDP file.
    Image 12
    Image 13

  2. Open the downloaded file, this launches the Remote Desktop Connection dialog.
    Image 14

  3. On the login screen:

  • Choose More choices → Use a different account.
  • Enter credentials:

    • Username: .\prime
    • Password: (the secure password you set earlier).
      1. Click OK to connect. Image 15 Image 16

Step 4: Install IIS Web Server

💡 What is IIS?
Internet Information Services (IIS) is Microsoft’s web server, used to host websites and web apps.

Steps:

  1. Once connected to the VM, right-click Start → Windows PowerShell (Admin).
    Image 17

  2. Install IIS with the command:

Install-WindowsFeature Web-Server -IncludeAllSubFeature -IncludeManagementTools
Enter fullscreen mode Exit fullscreen mode
  1. Navigate to the IIS root directory:
cd C:\inetpub\wwwroot\
Enter fullscreen mode Exit fullscreen mode
  1. Replace the default web page with a sample file:
Wget https://raw.githubusercontent.com/Azure-Samples/html-docs-hello-world/master/index.html -OutFile index.html
Enter fullscreen mode Exit fullscreen mode

✅ At this point, your VM is running IIS and serving a web page.
Image 18

Step 5: Verify the Web Server

  1. Open a browser on your local machine.
  2. Enter the Public IP address of your VM.
  3. You should see the “Static HTML Site” webpage, confirming IIS is installed and serving content successfully. Image 19

Conclusion

In this project, you’ve successfully:

  • Deployed a Windows Server VM in Azure.
  • Secured access by customizing inbound rules.
  • Connected remotely using RDP.
  • Installed IIS and verified web hosting.

This workflow is foundational for cloud administrators and developers who want to host applications, websites, or services on Azure. With IIS running, you can now extend this setup to deploy enterprise apps, configure load balancers, or integrate with Azure’s advanced monitoring and security tools.

Top comments (0)