Windows Server VMs on Azure

A Windows Server Azure VM is where most company apps still live: file servers, line-of-business apps, SQL Server, domain controllers. You build one much like a Linux VM, but a few details change, since you log in with a password instead of an SSH key, connect with RDP instead of SSH, and have to think about licensing and Windows activation.

In this lesson you’ll build win01 on Windows Server 2025 Datacenter: Azure Edition, Server Core. It fits the free account’s small B2ats v2 size, it has no public IP, and you log in to it through Bastion.

After that you’ll hit a problem that’s catching a lot of teams in 2026. A new Windows VM in a private subnet can’t activate, because activation has to reach Azure’s licensing servers over the internet.

TimeYou needCostBy the end you can
About 50 minutesvnet-saat, the CLI, a password managerAbout USD 0.05 if you clean up the temporary NAT Gateway within 1 hour; the VM uses the free account’s Windows B2ats v2 hoursBuild a private Windows Server VM, run PowerShell on it without RDP, connect with Bastion, and fix activation

What it is, in one line

A Windows Server VM on Azure is a licensed Windows server you rent by the minute, reach with RDP through Bastion and manage with PowerShell.

In Simple Words

The same flat, but with a front-desk register

A Windows VM is the same rented flat as the Linux one, with two differences. You get in with a password, because Windows doesn’t use SSH keys for RDP, and the flat has to be registered with the building office before the lights stop flickering, which is Windows activation.

The trouble is that the registration office sits outside your gated colony. If the colony has no exit gate (no outbound internet), the flat can’t register, and things carry on working for a while before warning signs start appearing on the walls.

Engineer's View

Images, sizes, licensing and activation

  • Images: the publisher is MicrosoftWindowsServer and the offer is WindowsServer, with SKUs like 2025-datacenter-azure-edition (Desktop Experience) and 2025-datacenter-azure-edition-core (Server Core). Azure Edition only runs on Azure and supports hotpatching. The -smalldisk variants come with a 30 GB OS disk instead of 127 GB.
  • Size: Desktop Experience is comfortable from 4 GiB of memory, and B2ats v2 only has 1 GiB, so the course uses Server Core. It runs fine on less memory, and plenty of production servers use it anyway.
  • Login: Windows VMs need --admin-password, and the CLI checks it on your machine: 12 to 123 characters, using three of lower case, upper case, numbers and symbols. Names like admin and administrator get refused.
  • Licensing: pay-as-you-go images have the Windows Server licence built into the hourly price, which is why Windows cost more than Linux back in Lesson 1. If you have Software Assurance, you can use Azure Hybrid Benefit (--license-type Windows_Server) and pay the Linux rate.
  • Activation: Azure VMs activate against Azure’s KMS servers at azkms.core.windows.net on TCP 1688. Those are public endpoints, so the VM needs outbound internet (a NAT Gateway, a firewall or a route) to get to them, and 168.63.129.16 doesn’t handle activation.

Run Command works the same as on Linux. RunPowerShellScript runs PowerShell as SYSTEM through the VM agent, without RDP or an open port, and it’s the quickest way to check or fix a Windows VM you can’t log in to.

How it works, step by step

Here’s roughly what the first hour of a new Windows VM looks like:

Windows Server Azure VM first hour: provisioning, agent, activation, updates, login
  1. Provisioning: Azure creates the NIC and the disk, sets up the admin account and runs Windows setup (sysprep’s “specialise” pass), which takes a few minutes longer than Linux does.
  2. Agent: the Azure VM agent starts up and reports “Ready” through 168.63.129.16, and from then on Run Command and extensions work.
  3. Activation: Windows tries to activate against Azure KMS on port 1688, and with no outbound access it fails quietly at first.
  4. Updates: Windows Update needs outbound access to Microsoft’s update servers too (or a patching service, Lesson 30).
  5. Login: you RDP in through Bastion with the admin account.

Steps 3 and 4 are the reason every Windows subnet needs an explicit outbound method from day one, even when the server never touches the internet as part of its job.

Windows Server Azure VM image choices for Windows Server 2025

In the lab you’ll build win01 in snet-mgmt, check it with Run Command, connect through Bastion and then sort out activation.

Hands-on lab: build and activate win01

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

win01 stays around (deallocated) for the later Windows lessons. Load the network IDs first:

$v = Get-Content C:\azure-lab\vnet-saat.json | ConvertFrom-Json

1Find the Windows Server 2025 image names

Run this:

az vm image list-skus --location centralindia --publisher MicrosoftWindowsServer --offer WindowsServer --query "[?starts_with(name,'2025')].name" -o tsv

You should see something like this (shortened):

2025-datacenter
2025-datacenter-azure-edition
2025-datacenter-azure-edition-core
2025-datacenter-azure-edition-core-smalldisk
2025-datacenter-azure-edition-smalldisk
2025-datacenter-core
2025-datacenter-core-smalldisk
2025-datacenter-smalldisk
...

Pick 2025-datacenter-azure-edition-core-smalldisk, which is Azure Edition, Server Core, with a 30 GB image. You’ll grow the disk to 64 GB, and the free account covers that. If the name in your list is slightly different, use the one with “azure-edition-core-smalldisk” in it.

2Create win01 with a generated password

Run this (it takes about four minutes):

$pw = 'Lab-' + [guid]::NewGuid().ToString('N').Substring(0, 12) + '!'
"Save this password for win01 / azureuser: $pw"
az vm create --resource-group rg-saat-vms --name win01 --image MicrosoftWindowsServer:WindowsServer:2025-datacenter-azure-edition-core-smalldisk:latest --size Standard_B2ats_v2 --subnet $v.'snet-mgmt' --public-ip-address '""' --nsg '""' --admin-username azureuser --admin-password $pw --os-disk-size-gb 64 --tags course=saatvedha-azure lesson=16 keep=true role=admin --query "{name:name, power:powerState, privateIp:privateIpAddress}" -o table

You should see something like this:

Save this password for win01 / azureuser: Lab-5e1c09a7b3d4!
Name    Power       PrivateIp
------  ----------  -----------
win01   VM running  10.30.10.4

Copy the password into your password manager straight away, because you’ll need it for Bastion, and don’t reuse it anywhere else.

3Check the VM with Run Command

Run this:

az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts 'Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, TotalVisibleMemorySize | Format-List' --query "value[0].message" -o tsv

You should see something like this:

Caption                : Microsoft Windows Server 2025 Datacenter: Azure Edition
Version                : 10.0.26100
TotalVisibleMemorySize : 967416

The memory figure is in kilobytes, so that’s about 945 MB usable out of the 1 GiB. The single quotes around the script stop your laptop’s PowerShell from changing anything in it, and the script has no double quotes inside, because Windows PowerShell 5.1 drops inner double quotes when it passes arguments to az. On the VM, the script runs as SYSTEM.

4Turn on auto-shutdown

Run this:

az vm auto-shutdown --resource-group rg-saat-vms --name win01 --time 1330 -o none

5Connect with Bastion Developer

  1. In the portal, open win01 > Connect > Connect via Bastion and use the Developer option.
  2. For Authentication type choose VM Password, with the username azureuser and the password you saved.
  3. A browser RDP session opens on Server Core, showing a command window with the SConfig menu. Type 15 and press Enter to drop to PowerShell, then run hostname.
Windows Server Azure VM in Bastion with SConfig
Server Core in the browser: SConfig, then option 15 for PowerShell.
Windows Server Azure VM lab: win01 created and checked with Run Command
Example output. Your IP and values will be different.

6Check activation

Back on your laptop, run this:

az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts 'cscript //nologo C:\Windows\System32\slmgr.vbs /dli' --query "value[0].message" -o tsv

You should see something like this:

Name: Windows(R), ServerDatacenterAzureEdition edition
Description: Windows(R) Operating System, VOLUME_KMSCLIENT channel
Partial Product Key: XXXXX
License Status: Notification
Notification Reason: 0xC004F056.

“Notification” means Windows is not activated, because it hasn’t been able to reach a licensing server. Keep that in mind, because “Break It” shows you why.

✅ Checkpoint: win01 runs Windows Server 2025 Azure Edition Core with no public IP, you logged in through Bastion, and you’ve noticed it isn’t activated yet.

Break It, Then Fix It

The first mistake stops you before anything gets built. The second turns up days later as a warning at every login, unless you know where to look.

1Break it: a password the CLI won’t accept

Run this:

az vm create --resource-group rg-saat-vms --name win99 --image MicrosoftWindowsServer:WindowsServer:2025-datacenter-azure-edition-core-smalldisk:latest --size Standard_B2ats_v2 --subnet $v.'snet-mgmt' --public-ip-address '""' --nsg '""' --admin-username azureuser --admin-password 'Winter2026'

You’ll get this error:

The password length must be between 12 and 123. Password must have the 3 of the following: 1 lower case character, 1 upper case character, 1 number and 1 special character.

The CLI checked it on your laptop, so nothing went to Azure. Winter2026 is 10 characters with no symbol, which is the sort of password a password-spray attack tries first, so generate your passwords instead, like you did in step 2.

2Break it: activate Windows from a private subnet

Tell Windows to activate now:

az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts 'cscript //nologo C:\Windows\System32\slmgr.vbs /ato; Test-NetConnection azkms.core.windows.net -Port 1688 | Select-Object ComputerName, TcpTestSucceeded' --query "value[0].message" -o tsv

You’ll get output like this:

Activating Windows(R), ServerDatacenterAzureEdition edition (...) ...
Error: 0xC004F074 The Software Licensing Service reported that the computer could not be activated. No Key Management Service (KMS) could be contacted. Please see the Application Event Log for additional information.

ComputerName           TcpTestSucceeded
------------           ----------------
azkms.core.windows.net False

Port 1688 on Azure KMS is out of reach, because snet-mgmt is a private subnet with no outbound method. Older VNets had default outbound access, so this used to work without anyone thinking about it. On new networks, servers that aren’t activated show a watermark, nag users to activate, and lose some features.

To fix it, give the subnet a way out for a little while, like in Lesson 13, and activate:

az group create --name rg-saat-l16 --tags course=saatvedha-azure lesson=16 -o none
az network public-ip create --resource-group rg-saat-l16 --name pip-saat-l16 --sku Standard --allocation-method Static --tags course=saatvedha-azure lesson=16 -o none
az network nat gateway create --resource-group rg-saat-l16 --name nat-saat-l16 --public-ip-addresses pip-saat-l16 --tags course=saatvedha-azure lesson=16 -o none
$nat = az network nat gateway show --resource-group rg-saat-l16 --name nat-saat-l16 --query id -o tsv
az network vnet subnet update --ids $v.'snet-mgmt' --nat-gateway $nat -o none
Start-Sleep -Seconds 60
az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts 'cscript //nologo C:\Windows\System32\slmgr.vbs /ato; cscript //nologo C:\Windows\System32\slmgr.vbs /dli | Select-String License' --query "value[0].message" -o tsv

You should see something like this:

Activating Windows(R), ServerDatacenterAzureEdition edition (...) ...
Product activated successfully.

License Status: Licensed

KMS activation lasts 180 days and renews itself every 7 days as long as the server can reach KMS. Later lessons give snet-mgmt a permanent outbound path, so for now remove the temporary NAT Gateway.

Clean up and deallocate win01:

az network vnet subnet update --ids $v.'snet-mgmt' --remove natGateway -o none
az group delete --name rg-saat-l16 --yes
az vm deallocate --resource-group rg-saat-vms --name win01
C:\azure-lab\Find-LabResources.ps1 -Lesson 16

You should see this at the end (win01 and its disk and NIC stay, tagged lesson=16 and keep=true):

Resources:

name                          type                                     group       lesson
----                          ----                                     -----       ------
win01                         Microsoft.Compute/virtualMachines        rg-saat-vms 16
win01_OsDisk_1_...            Microsoft.Compute/disks                  RG-SAAT-VMS 16
win01VMNic                    Microsoft.Network/networkInterfaces      rg-saat-vms 16
shutdown-computevm-win01      microsoft.devtestlab/schedules           rg-saat-vms 16
Windows Server Azure VM errors: weak password and KMS activation 0xC004F074
Example output of both problems and the fix.

✅ Checkpoint: win01 shows “Product activated successfully”, the temporary NAT Gateway is gone, and win01 is deallocated.

This happened at work

“Activate Windows” on 60 new servers

This was at a bank that built a new landing zone in 2026, with private subnets everywhere and a firewall that only let through traffic the security team had signed off. Over a month, the migration team moved 60 Windows servers into it. Everything worked and the project was closed as done.

A few weeks later the service desk started getting tickets saying “My screen says Activate Windows”, and it turned out none of the migrated servers were activated. The firewall had no rule for Azure KMS on port 1688, and with no default outbound access the servers had no way to reach it.

Nobody spotted it in testing, because a failed activation doesn’t stop applications from running.

What they changed: the firewall got an application rule for azkms.core.windows.net on TCP 1688, along with the Windows Update endpoints. The build checklist now includes slmgr /dli and a check that Test-NetConnection azkms.core.windows.net -Port 1688 succeeds. Once a month, a Run Command report across all the Windows VMs lists any server whose licence status isn’t “Licensed”.

Common mistakes and troubleshooting

MistakeWhat you seeWhat to do
No outbound path for Windows subnets“Activate Windows”, 0xC004F074, update failuresAllow TCP 1688 to azkms.core.windows.net through NAT or the firewall.
Desktop Experience on a 1 GiB sizeVery slow logins and hangsUse Server Core, or pick a size with 4 GiB or more.
Weak or reused admin passwordsCLI refuses, or later a compromised serverGenerate passwords and keep them in a password manager or Key Vault.
127 GB default disk on the free accountA P10 disk you pay forUse a smalldisk image and set the size to 64 GB.
Opening RDP 3389 to the internetThousands of failed logins a dayDon’t give it a public IP. Use Bastion (Lesson 27) or JIT (Lesson 28).
Double quotes in Run Command scriptsLaptop PowerShell eats $ variablesPut single quotes around the script and don’t use double quotes inside it.

Interview questions

Click a question to open it. Each one is worded the way an interviewer would put it, and underneath you’ll find why they ask it and one way you could answer in your own words.

Fresher level

1. How is creating a Windows VM different from a Linux VM in Azure?

Why they ask this: They want the practical differences.

How you might answer: On Windows you need an admin password instead of SSH keys and you connect with RDP instead of SSH. The image includes the Windows licence unless you use Azure Hybrid Benefit, and Windows has to activate against Azure KMS. Provisioning takes a few minutes longer too.

2. What is Azure Hybrid Benefit for Windows Server?

Why they ask this: A common licensing question.

How you might answer: If the company owns Windows Server licences with Software Assurance, it can use them on Azure VMs with --license-type Windows_Server and pay the base compute rate rather than the rate with the licence built in.

3. What does Run Command let you do on a Windows VM?

Why they ask this: They want to know your break-glass tools.

How you might answer: It runs a PowerShell script as SYSTEM through the VM agent, with no RDP and no open port. I use it to check services, read logs, reset settings or fix the firewall when I can’t get in.

2–5 years experience

4. New Windows VMs show “Activate Windows”. What’s your first check?

Why they ask this: They’re checking a very current, real-world issue.

How you might answer: I’d run slmgr /dli and test TCP 1688 to azkms.core.windows.net from the VM, because in private subnets or behind a strict firewall the VM often can’t get to Azure KMS. The fix is an outbound path or a firewall rule for KMS, and then slmgr /ato.

5. Why would you choose Server Core over Desktop Experience?

Why they ask this: They want reasons beyond “it’s smaller”.

How you might answer: Server Core needs less memory and disk, has fewer parts to patch and attack, and doesn’t reboot as often. You can manage most roles remotely with PowerShell, Windows Admin Center or Run Command, so there’s no need for a GUI on the server.

6. How do you manage Windows admin passwords for many VMs?

Why they ask this: They want secure, scalable practice.

How you might answer: Each VM gets its own random password at build time, kept in Key Vault, and ideally Windows LAPS rotates the local admin password after that. For day-to-day admin work people use domain or Entra ID accounts, not the local admin.

Senior level

7. You’re designing a landing zone with private subnets and a firewall. What must Windows servers be allowed to reach?

Why they ask this: They want a concrete list, not “the internet”.

How you might answer: At the very least Azure KMS on TCP 1688 for activation, Windows Update or the company’s own patch source, the Azure monitoring and management endpoints the agents talk to, and any certificate revocation endpoints. I’d use the firewall’s FQDN tags where they exist and test each one from a fresh server before migration.

8. How would you check licence status across 300 Windows VMs?

Why they ask this: They want a scalable method.

How you might answer: I’d use a Run Command script or Azure Policy guest configuration that runs slmgr /dli or reads the SoftwareLicensingProduct class and reports anything that isn’t “Licensed”. The results go into Log Analytics, and a KQL query lists the failures for the team.

9. When would you still use Desktop Experience on Azure?

Why they ask this: They want balanced judgement.

How you might answer: For apps that need a GUI on the server, like some older line-of-business tools, or for Remote Desktop Session Hosts. I’d give those VMs enough memory and keep their number small.

Quick quiz

Q1. Which image did the lab use for win01?

  1. 2025-datacenter (Desktop)
  2. 2025-datacenter-azure-edition-core-smalldisk
  3. 2022-datacenter
  4. windows-11
Show answer

B — Azure Edition, Server Core, with a 30 GB image grown to 64 GB.

Q2. Why did activation fail at first?

  1. Wrong product key
  2. The private subnet had no outbound path to Azure KMS on port 1688
  3. Server Core can’t be activated
  4. Bastion blocks it
Show answer

B — Activation needs outbound access to azkms.core.windows.net.

Q3. What does “License Status: Notification” mean?

  1. Activated
  2. Not activated
  3. Evaluation edition
  4. Licence expired permanently
Show answer

B — Notification means Windows isn’t activated.

Q4. Why put the Run Command script in single quotes in PowerShell?

  1. They’re faster
  2. So your laptop doesn’t expand $ variables before sending the script
  3. Azure requires them
  4. To hide the script
Show answer

B — The script then runs on the VM exactly as written.

Q5. Which minimum password length does the CLI enforce for VMs?

  1. 8
  2. 10
  3. 12
  4. 16
Show answer

C — 12 to 123 characters with three character types.

Quick recap

You can now build a private Windows server, manage it without RDP and fix the activation problem that comes with new networks.

  • Windows VMs use passwords and RDP; generate strong passwords and store them safely.
  • Server Core on B2ats v2 fits the free account; Desktop Experience needs more memory.
  • Azure Edition runs only on Azure and supports hotpatching.
  • Activation needs TCP 1688 to azkms.core.windows.net: private subnets need an outbound path.
  • win01 stays deallocated in rg-saat-vms for later lessons.

Next lesson

Lesson 17: Azure VM sizes: B, D, E and F series → You’ll learn to read VM size names, compare the families and resize web01 safely.

Further reading: Windows Server Azure VM

Want to go deeper into Windows Server Azure VM? See Microsoft’s Create a Windows virtual machine with the Azure CLI and Troubleshoot Azure Windows virtual machine activation problems. You can also see the full plan for this course on the Azure Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.