Last updated: May 2026
Azure Virtual Machines Beginner AZ-104 ⏱ 15 min read

Create a Windows VM in Azure

Creating a Windows VM in Azure is straightforward once you understand what each setting does. This page walks you through every step — from the Azure Portal, with equivalent CLI commands alongside each step. By the end, you'll have a running Windows Server VM and understand every configuration choice you made.

What you'll learn Creating a VM via the Azure Portal · Every configuration option explained · Equivalent Azure CLI commands · Networking basics for VMs · Disk configuration · Administrator credentials · Connecting via RDP · Common mistakes to avoid

Prerequisites

  • An Azure account — sign up free here
  • Access to the Azure Portal at portal.azure.com
  • A Resource Group to deploy into (create one first if needed)
💡
Cost Warning A Windows VM incurs costs even when idle (OS licence fee). Always deallocate (stop) the VM when not using it — or delete it entirely after this tutorial. A B2s Windows VM costs approximately ₹3,500–4,000/month on pay-as-you-go.

Create VM via Azure Portal

Navigate to the Azure Portal and follow these steps:

  1. In the search bar, type Virtual Machines and click it
  2. Click + CreateAzure virtual machine
  3. The "Create a virtual machine" wizard opens with multiple tabs

Basics Tab — Explained

The Basics tab is where you configure the core identity and compute settings of your VM.

Subscription & Resource Group

Select your subscription and the Resource Group where the VM will live. Create a new Resource Group if needed — name it something like rg-windows-vm-demo.

Virtual Machine Name

Choose a meaningful name. Azure VM names have rules:

  • 1–15 characters for Windows VMs
  • Letters, numbers, and hyphens only
  • Cannot start or end with a hyphen
  • Must be unique within the Resource Group
💡
Naming Convention Use a consistent pattern: vm-[purpose]-[env]-[number]
Example: vm-webserver-prod-01 or vm-sqldb-dev-01

Region

Choose the region closest to your users. For Indian workloads, use Central India (Pune). Remember — not all VM sizes are available in all regions.

Availability Options

This determines your redundancy level:

OptionSLAUse For
No infrastructure redundancy99.9% (Premium SSD)Dev/test, single-instance apps
Availability Zone99.99%Production — zone-level protection
Availability Set99.95%Legacy approach — use zones instead
Virtual Machine Scale Set99.99%Auto-scaling applications

Security Type

Leave as Trusted launch virtual machines for most workloads. This enables Secure Boot and vTPM for enhanced security.

Image

The operating system image. For Windows, common choices:

  • Windows Server 2022 Datacenter — Latest, recommended for new workloads
  • Windows Server 2019 Datacenter — Stable, widely used
  • Windows 11 Pro — Desktop OS for developer workstations
  • Windows 10 Pro — Desktop OS (older)

Size

Click See all sizes to browse all available VM sizes for your region. For this tutorial, use Standard_B2s (2 vCPUs, 4 GB RAM) — cheap and sufficient for learning.

Administrator Account

Create a local administrator account for the VM:

  • Username — Cannot be "admin", "administrator", "root", "guest", or "test"
  • Password — Minimum 12 characters, must include uppercase, lowercase, number, and special character
⚠️
Save Your Credentials! Azure does not store VM passwords. If you forget your administrator password, recovering access is complex. Write it down or use a password manager immediately.

Inbound Port Rules

For Windows VMs you need RDP (port 3389) to connect. Select:

  • Public inbound ports: Allow selected ports
  • Select inbound ports: RDP (3389)
⚠️
Security Note Opening RDP to the internet (0.0.0.0/0) is a security risk — bots constantly scan for open RDP ports. For production, use Azure Bastion instead. For this tutorial/learning, it's acceptable but restrict the source IP to your own IP address after creation.

Disks Tab — Explained

OS Disk Type

Choose the storage type for your OS disk:

Disk TypePerformanceCostUse For
Premium SSDHigh IOPS, low latencyHigherProduction workloads — also needed for 99.9% SLA
Standard SSDModerate IOPSMediumDev/test, light production
Standard HDDLow IOPSLowestBackups, archives — no SLA

Delete OS disk when VM is deleted

Check this box! By default, the OS disk is NOT deleted when you delete the VM. Ticking this saves you from orphaned disk charges.

Networking Tab — Explained

Virtual Network

Azure will create a new VNet automatically if you don't have one. For a tutorial VM, the default is fine. Name it something like vnet-demo.

Subnet

A subnet within the VNet. Default subnet (10.0.0.0/24) is fine for this tutorial.

Public IP

Required if you want to connect to the VM from the internet. A new Standard SKU public IP is created automatically. Note: public IPs are billed even when the VM is stopped.

NIC Network Security Group

The firewall for your VM. Select Basic for this tutorial — it will configure RDP access based on your earlier port selection. For production, use Advanced to create custom rules.

Delete NIC when VM is deleted

Check this box — same reason as OS disk. Prevents orphaned NIC charges.

Management Tab — Key Settings

Auto-shutdown

Enable auto-shutdown with a time (e.g., 8 PM daily). This is extremely useful for dev/test VMs — it automatically deallocates the VM every evening, saving cost.

Azure Monitor agent

Install this to collect performance metrics and logs. Recommended for production VMs — leave it enabled.

Review + Create

Click Review + create. Azure validates your configuration — if anything is wrong, it highlights the issue and which tab to fix it on. Once validation passes, you see a summary with the estimated monthly cost. Click Create to deploy.

Deployment typically takes 2–5 minutes. You'll see a notification in the portal when complete.

Create via Azure CLI

The entire VM creation can be done in one CLI command:

Azure CLI Create a Windows VM
# Create resource group first
az group create \
  --name rg-windows-vm-demo \
  --location centralindia

# Create the Windows VM
az vm create \
  --resource-group rg-windows-vm-demo \
  --name vm-windows-demo \
  --image Win2022Datacenter \
  --size Standard_B2s \
  --admin-username azureuser \
  --admin-password "YourSecureP@ssword123!" \
  --location centralindia \
  --public-ip-sku Standard

# Open RDP port 3389
az vm open-port \
  --resource-group rg-windows-vm-demo \
  --name vm-windows-demo \
  --port 3389
💡
Get the Public IP After Creation After the VM is created, get its public IP to connect via RDP:
Azure CLI Get VM public IP address
az vm show \
  --resource-group rg-windows-vm-demo \
  --name vm-windows-demo \
  --show-details \
  --query publicIps \
  --output tsv

After the VM is Created

Once deployed, connect to your VM via RDP:

  1. In the Azure Portal, go to your VM → click ConnectRDP
  2. Download the .rdp file
  3. Open the .rdp file — Windows Remote Desktop opens
  4. Enter your administrator username and password
  5. Accept the certificate warning and connect

You're now inside a Windows Server running in Azure's data centre in Pune!

Cleaning Up

To avoid ongoing charges, clean up when done:

Azure CLI Delete the entire resource group and all resources
az group delete \
  --name rg-windows-vm-demo \
  --yes \
  --no-wait
💡
Deallocate vs Delete Deallocating a VM stops compute billing but keeps the disk (small storage charge). Deleting removes everything. For learning VMs, delete the whole resource group when done — it removes the VM, disk, NIC, and public IP in one command.
📝 Practice Questions
Click an option to check your answer. AZ-104 style questions.
Q1. What is the maximum character length for a Windows VM name in Azure?
A 63 characters
B 20 characters
C 15 characters
D 255 characters
Q2. Which port must be open in the Network Security Group to connect to a Windows VM via RDP?
A Port 22
B Port 80
C Port 443
D Port 3389
Q3. A developer creates a Windows VM for testing and deletes it after finishing. They later notice they are still being charged for storage. What is the most likely cause?
A The VM is still running in a different region
B The OS disk was not deleted when the VM was deleted
C Azure automatically created a backup of the VM
D A snapshot was automatically taken during deletion
Q4. What is the difference between stopping (deallocating) a VM and deleting it?
A Stopping a VM still incurs full compute charges; deleting stops all charges
B Stopping keeps the VM and disk (small storage charge); deleting permanently removes everything
C Stopping and deleting are the same — both permanently remove the VM
D A stopped VM cannot be restarted without creating a new one
Q5. Which disk type is required for a single Windows VM to qualify for Microsoft's 99.9% uptime SLA?
A Standard HDD
B Standard SSD
C Premium SSD
D Ultra Disk
Comments
Disclaimer: RedKite Cloud is an independent educational resource and is not affiliated with, endorsed by, or officially connected to Microsoft Corporation. All product names, logos, and trademarks are property of their respective owners. Content is written independently for educational purposes only.