Systems Admin

SQL Always On Availability Groups Part 1: Creating Hyper-V VMs

SQL Server Always On Availability Groups (AG) are the modern HA + DR primitive for SQL workloads. Two or more SQL nodes hold synchronized copies of the same database. A listener (virtual network name) sits in front, so applications connect to one address and reach whichever node is currently primary — failover is transparent.

This is the first part of a 7-post series that builds a complete AG lab from bare metal:

  1. Part 1 (this article) — create two identical Hyper-V VMs that will become SQL-NODE-01 and SQL-NODE-02
  2. Part 2 — install SQL Server 2022 + SSMS on both nodes
  3. Part 3 — configure Windows Failover Clustering across both nodes
  4. Part 4 — create the database that will be in the AG
  5. Part 5 — configure the Availability Group + listener VNN
  6. Part 6 — verify replica synchronization
  7. Part 7 — manual failover testing

Production setup: two physical hosts. Lab setup: two Hyper-V VMs — identical RAM, vCPU, OS version. Same domain, same SQL service account.

Build VM #1 — SQL-NODE-01

Hyper-V Manager Action pane with New Virtual Machine option being selected to begin VM creation
In Hyper-V Manager Action pane > New > Virtual Machine. Build two identical VMs — SQL-NODE-01 and SQL-NODE-02 — in this same flow.

Open Hyper-V Manager on your physical host. Action pane > New > Virtual Machine.

Before You Begin page of the New Virtual Machine Wizard with Next button visible
Before You Begin > Next.

Before You Begin > Next.

Specify Name and Location step with the VM name SQL-NODE-01 entered
Name: SQL-NODE-01 > Next. Pick a location with enough free disk for the OS VHDX.

Name: SQL-NODE-01. Storage location: pick a path with enough free space for the 80 GB OS VHDX (and later, larger SQL data VHDXs).

Specify Generation step with Generation 2 radio button selected for UEFI boot support
Generation: Generation 2 (UEFI / Secure Boot) > Next. Required for SQL 2022.

Generation: Generation 2. Required for SQL Server 2022 + UEFI / Secure Boot. Don’t pick Gen 1 even “just to see if it works.”

Assign Memory step with the Startup memory set in megabytes for the new VM
Startup memory: 8192 MB minimum (16+ GB for any real workload). Leave dynamic memory off for SQL — SQL prefers a fixed allocation.

Startup memory: 8192 MB for a lab. Production: 16+ GB minimum, 32+ GB if real workloads. Leave dynamic memory OFF — SQL Server prefers a fixed allocation it can grab once and hold.

Configure Networking step with the External vSwitch chosen so the VM can reach the domain
Connect to your External vSwitch so the VM can reach the domain controller. Internal/private switches will block AD join.

Network: External vSwitch. The VMs need to reach your DC for AD join, Kerberos, and DNS. An Internal or Private switch isolates them from the domain and breaks the lab.

Connect Virtual Hard Disk step with the new fixed-size VHDX path and capacity entered
Disk size: 80 GB for the OS volume (SQL data goes on a separate VHDX later). Use Fixed type for production-like performance.

Virtual hard disk: 80 GB for the OS volume. Choose Fixed type for production-like I/O. Dynamic VHDXs grow on first write, hurting SQL benchmark numbers.

Installation Options step with the Browse button used to attach the Windows Server 2025 ISO
Browse > pick the Windows Server 2025 ISO > Next.

Install an OS from a bootable image file > Browse > pick the Windows Server 2025 ISO. Next.

Completing the New Virtual Machine Wizard summary page with the Finish button visible
Review > Finish.

Review the summary > Finish.

Bump vCPU after creation

VM Settings dialog with the Processor pane open and the virtual processor count being increased
Open the VM’s Settings > Processor > bump virtual processors to 4+. Apply. SQL needs more than the default 1 vCPU.

VM created with 1 vCPU by default. Right-click the VM > Settings > Processor > set Number of virtual processors to 4 (or more). Apply.

SQL Server licensing aside, 1 vCPU starves the cluster heartbeat, sync replication, and any meaningful query work.

Build VM #2 — SQL-NODE-02

Repeat the entire wizard with the name SQL-NODE-02 and identical settings (Gen 2, 8 GB RAM, External vSwitch, 80 GB Fixed VHDX, Win Server 2025 ISO, 4 vCPU). Identical specs are not optional — mismatched VMs cause AG init failures later.

Hyper-V Manager Virtual Machines list showing both SQL-NODE-01 and SQL-NODE-02 in the Off state ready to start
Repeat the entire flow for SQL-NODE-02. Now both VMs sit in the Off state ready for OS install.

Both VMs in Off state, ready to install the OS.

Install Windows Server 2025 (do this on both)

Right-click context menu on a VM with the Connect option highlighted to open the console
Right-click VM > Connect.

Right-click VM > Connect to open the console.

VM console showing the boot prompt where the spacebar must be pressed to load the ISO installer
Click Start in the console window > fast-press the spacebar several times so the ISO loads (timing window is short).

Click Start in the console > fast-press spacebar several times to catch the ISO boot prompt. Miss the window and Hyper-V boots from the (empty) VHDX instead and you have to power-cycle.

Windows Setup language and keyboard selection screen with the default options retained
Language / keyboard > Next.

Language + keyboard layout > Next.

Windows Setup Install Now screen with the Install Now button highlighted
Install Now.

Install Now.

Windows Setup product key entry skipped to use the evaluation edition
Skip the product key — uses evaluation edition (180 days).

Skip the product key — uses 180-day evaluation. (Eval edition gives Enterprise features, including readable secondary in AG — useful for testing.)

Windows Setup operating system selection with the server desktop experience SKU chosen
OS edition: pick Windows Server 2025 (Desktop Experience) > Next.

OS edition: Windows Server 2025 (Desktop Experience). Server Core works too but the SQL setup wizard is friendlier with Desktop Experience for first-time installs.

Windows Setup partition step with Create New Partition selected on the unallocated disk
Partition > New on the unallocated disk.

Partition > New on the unallocated 80 GB.

Windows Setup partition Apply confirmation dialog accepted to create the system partition
Apply > OK to confirm partition creation.

Apply > OK to confirm. Windows creates a small system partition + the main OS partition.

Windows Setup ready to install summary page with the chosen edition and partition shown
Review the partition layout > Next.

Final layout review > Next.

Windows Setup installation progress screen showing files being copied and features prepared
Final summary > Install.

Confirm summary > Install.

Windows Setup completion screen waiting for first boot after multiple restarts during install
Install runs ~10-15 min, multiple reboots. Wait it out.

Install runs 10-15 min with multiple reboots. Don’t interrupt.

Initial sign-in prompt to set the local administrator password before first login to the new server
Set the local Administrator password > Finish. Log in.

Set the local Administrator password > Finish. Log in for the first time.

Post-install checklist (every node)

Server Manager view confirming basic configuration like rename join domain disable firewall and IE security tasks have been completed
Post-install checklist on each node: rename to SQL-NODE-0X • join the AD domain • disable IE Enhanced Security • assign static IP • turn off Windows Firewall (or open SQL ports) • enable Remote Desktop • set the time zone.

Before SQL touches this box, do all of:

  1. Rename to SQL-NODE-01 / SQL-NODE-02
  2. Join the AD domain (e.g. contoso.local)
  3. Set a static IP (DHCP-assigned IPs break clustering)
  4. Disable IE Enhanced Security Configuration (Server Manager > Local Server)
  5. Disable Windows Firewall or open the SQL ports (1433, 5022 for AG endpoint, 47001 for SCM)
  6. Enable Remote Desktop
  7. Set the time zone (cluster nodes must agree on time within 5 min)

Copy the SQL installers to the VM

File Explorer showing the SQL Server 2022 ISO and SSMS installer files copied or downloaded onto the VM
Copy the SQL Server 2022 ISO + SSMS installer to the VM. Either copy from the host or download fresh inside the VM.

Copy the SQL Server 2022 ISO and the latest SSMS installer to a folder on the VM. Either drag from the Hyper-V host into the VM session, or download fresh from inside the VM.

Create the SQL service account, add it to local admins

Local Users and Groups Administrators group with the SQL service AD account being added as a member
Add the SQL service AD account to the local Administrators group on this VM. Create a normal AD user (e.g. CONTOSO\sql-svc) ahead of time — this account owns SQL Server, Agent, and the cluster role.

Open Computer Management > Local Users and Groups > Administrators > Add > the AD account that will run the SQL services (e.g. CONTOSO\sql-svc).

This account is created in AD ahead of time as a regular domain user. It does NOT need Domain Admin. It DOES need to be a local admin on every SQL node, plus the SPN write permission you’ll set later. One account covers SQL Engine, SQL Agent, and the AG cluster role across both nodes.

Sign out and sign back in as the service account

Windows lock screen prepared for sign-out from local admin and sign-in using the SQL service account
Sign out from the local admin and sign back in using the SQL service account. SQL setup picks up identity from the running session, and a clean install requires the service account is logged in.

Sign out from the local admin session and log back in as CONTOSO\sql-svc on this VM. Repeat the entire post-install checklist + service-account login on SQL-NODE-02 too. Don’t skip any step — mismatched configuration here surfaces as cryptic errors during AG init in Part 5.

Things that bite people

Dynamic memory ON for SQL VMs

Hyper-V Dynamic Memory expands and contracts the VM’s RAM based on host pressure. SQL Server hates this — it grabs RAM up to its max-server-memory setting and never releases. Set RAM to a fixed allocation in Hyper-V settings.

Identical RAM/vCPU on both nodes

If SQL-NODE-01 has 8 GB and SQL-NODE-02 has 16 GB, the AG works but failover behavior is asymmetric — performance changes when the workload moves to the smaller node. Match exactly.

Internal vSwitch instead of External

Internal vSwitches don’t reach the host’s physical network — you can’t join AD, can’t resolve DNS, can’t talk to the listener from outside. Use External.

Forgot to add SQL service account to local admins

SQL Setup needs admin rights at install time. If you start setup as a non-admin domain user, it stalls on permission errors with vague messages. Always pre-stage the service account into local admins and log in as it before launching SQL setup.

Mismatched OS builds

SQL-NODE-01 on Windows Server 2025, SQL-NODE-02 on 2022 = WSFC validation FAIL in Part 3. Match OS edition and patch level exactly.

What’s next

Part 2 in the SQL Availability Groups pathway: install SQL Server 2022 + SSMS on both nodes, set the service account at install time, configure mixed-mode auth, set TCP/IP, and verify SQL is reachable from each node.

Leave a Reply