This guide walks through your first Windows Server VM in Azure – and shows how to keep it secure and cheap. Use a free/trial subscription or a lab subscription from your company, never production.
Plan first
| Decision | Lab choice | Why |
|---|---|---|
| Resource group | rg-winops-lab |
Everything for the lab in one place – easy to delete |
| Region | Close to you, e.g. Central India | Low latency |
| Image | Windows Server 2022 or 2025 Datacenter | Current, supported |
| Size | A small B-series or D2-series | Enough for a lab |
| Admin access | Azure Bastion, or RDP only from your own IP | Never open RDP to the internet |
Option 1: Azure portal
- Create a resource → Virtual machine.
- Basics: subscription, resource group rg-winops-lab (create new), name vm-lab-win01, region, image Windows Server 2022 Datacenter, size.
- Administrator account: a username (not administrator) and a strong password.
- Inbound port rules: choose None if you’ll use Bastion; otherwise allow RDP and restrict it in the next step.
- Disks: Standard SSD is fine for a lab.
- Networking: a new VNet and subnet are created for you. Public IP: None with Bastion.
- Management: enable auto-shutdown (e.g. 20:00 your time) – the best cost-saving setting for labs.
- Review + create.
Option 2: Azure PowerShell
Install-Module Az -Scope CurrentUser # once
Connect-AzAccount
$rg = 'rg-winops-lab'; $loc = 'centralindia'
New-AzResourceGroup -Name $rg -Location $loc
$cred = Get-Credential -Message 'Local admin for the VM (not "administrator")'
New-AzVM -ResourceGroupName $rg -Location $loc -Name 'vm-lab-win01' `
-Image 'Win2022Datacenter' -Size 'Standard_B2s' `
-Credential $cred -VirtualNetworkName 'vnet-lab' -SubnetName 'snet-servers' `
-SecurityGroupName 'nsg-lab-win01' -OpenPorts 3389
-OpenPorts 3389 opens RDP to the whole internet – fix that immediately by restricting the rule to your IP:
$myIp = (Invoke-RestMethod https://api.ipify.org)
$nsg = Get-AzNetworkSecurityGroup -ResourceGroupName $rg -Name 'nsg-lab-win01'
$rule = $nsg.SecurityRules | Where-Object DestinationPortRange -contains '3389'
$rule.SourceAddressPrefix = @("$myIp/32")
$nsg | Set-AzNetworkSecurityGroup
(Or omit -OpenPorts and use Bastion.) VM size and image names change over time – check what’s available in your region with Get-AzVMSize -Location $loc.
Connect securely
- Azure Bastion: VM → Connect → Bastion – RDP in the browser, no public IP or open port on the VM. The best choice beyond a quick lab (it has an hourly cost).
- RDP: only with the NSG rule limited to your IP, as above.
First steps inside the VM
The same as any Windows server (Windows Server basics): check updates, set the time zone, and install only the roles you need. In real environments, VMs join the domain and receive their configuration from Group Policy or Ansible – not by hand.
Clean up – avoid surprise bills
Remove-AzResourceGroup -Name 'rg-winops-lab' -Force
Deleting the resource group removes the VM, disks, IPs and network in one go. Stopping a VM from the portal (“Stopped (deallocated)”) stops compute charges, but disks are still billed.
What’s next
Next: Launch a Windows EC2 instance in AWS.
Practise this topic
Test yourself with free questions on this topic – instant answers and explanations.
Start practice questionsAzureWindows ServerCloudVirtual MachinesBeginner