Skip to content

Latest commit

 

History

History
 
 

Running WSLab in Azure

Overview

I was always wondering how fast will be Azure VM to host WSLab since we announced availability of nested virtualization in Azure. Thanks to @DaveKawula tweet I decided to give it a try as i have MSDN subscription with ~130eur credit/month

You can find here several options on how to create a VM in Azure that is capable to run WSLab. I learned something new, I hope you will too. It will configure Hyper-V roles and download and extract scripts to d:\ drive.

Note: I recommend reverse engineering JSON as you can learn how to configure VMs in Azure.

I also added Windows 10 1803 machine, as nested 1803 and insider builds does not work well on Windows Server 2016. You will see provisioning errors, but all works well (looks like it does not evaluate state correctly after enabling Hyper-V with DISM PowerShell module)

Creating VM with PowerShell

To create VM with PowerShell, run following command.

Note: PowerShell DSC in this case does not run, therefore you need to install Hyper-V and download scripts manually.

#download Azure module if not installed
if (!(get-module -Name AzureRM* -ListAvailable)){
    Install-Module -Name AzureRM
}

#login to your azure account
Login-AzureRmAccount

#Create VM
New-AzureRmVm `
    -ResourceGroupName "WSLabRG" `
    -Name "WSLab" `
    -Location "West Europe" `
    -VirtualNetworkName "WSLabVirtualNetwork" `
    -SubnetName "WSLab" `
    -SecurityGroupName "WSLabSG" `
    -PublicIpAddressName "WSLabPubIP" `
    -OpenPorts 80,3389 `
    -ImageName Win2016Datacenter `
    -Size Standard_D16s_v3 `
    -Credential (Get-Credential) `
    -Verbose

#connect to VM using RDP
mstsc /v:((Get-AzureRmPublicIpAddress -ResourceGroupName WSLabRG).IpAddress)

Creating VM with JSON in UI

Windows Server 2016

Windows Server 2019 Insider preview

Windows 10 1803

Note: for some reason deployment fails, but everything is configured OK. Bug created here

Creating VM with JSON and PowerShell

Or you can create your VM using PowerShell

Windows Server 2016

#download Azure module if not installed
if (!(get-module -Name AzureRM* -ListAvailable)){
    Install-Module -Name AzureRM
}

#login to your azure account
Login-AzureRmAccount

#Deploy VM to Azure using Template
    New-AzureRmResourceGroup -Name "WSLabRG" -Location "West Europe"
    $TemplateUri="https://raw.githubusercontent.com/Microsoft/WSLab/master/Scenarios/Running%20WSLab%20in%20Azure/WSLab.json"
    New-AzureRmResourceGroupDeployment -Name WSLab -ResourceGroupName WSLabRG -TemplateUri $TemplateUri -Verbose

#connect to VM using RDP
    mstsc /v:((Get-AzureRmPublicIpAddress -ResourceGroupName WSLabRG).IpAddress)
 

Windows Server 2019 Insider preview

#download Azure module if not installed
if (!(get-module -Name AzureRM* -ListAvailable)){
    Install-Module -Name AzureRM
}

#login to your azure account
Login-AzureRmAccount

#Deploy VM to Azure using Template
    New-AzureRmResourceGroup -Name "WSLabRGInsider" -Location "West Europe"
    $TemplateUri="https://raw.githubusercontent.com/Microsoft/WSLab/master/Scenarios/Running%20WSLab%20in%20Azure/WSLabServerInsider.json"
    New-AzureRmResourceGroupDeployment -Name WSLabInsider -ResourceGroupName WSLabRGInsider -TemplateUri $TemplateUri -Verbose

#connect to VM using RDP
    mstsc /v:((Get-AzureRmPublicIpAddress -ResourceGroupName WSLabRGInsider).IpAddress)
 

Windows 10 1803

#download Azure module if not installed
if (!(get-module -Name AzureRM* -ListAvailable)){
    Install-Module -Name AzureRM
}

#login to your azure account
Login-AzureRmAccount

#Deploy VM to Azure using Template
    New-AzureRmResourceGroup -Name "WSLabwin10RG" -Location "West Europe"
    $TemplateUri="https://raw.githubusercontent.com/Microsoft/WSLab/master/Scenarios/Running%20WSLab%20in%20Azure/WSLabwin10.json"
    New-AzureRmResourceGroupDeployment -Name WSLabwin10 -ResourceGroupName WSLabwin10RG -TemplateUri $TemplateUri -Verbose
#connect to VM using RDP
    mstsc /v:((Get-AzureRmPublicIpAddress -ResourceGroupName WSLabwin10RG).IpAddress)
 

Cleanup the VM and resources

To cleanup your resources, you can run following command.

Windows Server 2016

Get-AzurermVM -Name WSLab -ResourceGroupName WSLabRG | Remove-AzureRmVM -verbose #-Force
Get-AzureRmResource | where name -like WSLab* | Remove-AzureRmResource -verbose #-Force 
Get-AzureRmResourceGroup | where resourcegroupname -eq WSLabRG | Remove-AzureRmResourceGroup -Verbose #-Force
 

Windows Server 2019 Insider Preview

Get-AzurermVM -Name WSLab -ResourceGroupName WSLabRGInsider | Remove-AzureRmVM -verbose #-Force
Get-AzureRmResource | where name -like WSLABInsider* | Remove-AzureRmResource -verbose #-Force 
Get-AzureRmResourceGroup | where resourcegroupname -eq WSLabRGInsider | Remove-AzureRmResourceGroup -Verbose #-Force
 

Windows 10 1803

Get-AzurermVM -Name WSLabwin10 -ResourceGroupName WSLabwin10RG | Remove-AzureRmVM -verbose #-Force
Get-AzureRmResource | where name -like WSLabwin10* | Remove-AzureRmResource -verbose #-Force 
Get-AzureRmResourceGroup | where resourcegroupname -eq WSLabwin10RG | Remove-AzureRmResourceGroup -Verbose #-Force
 

Creating VM Manually

To create VM, click on New and select Windows Server 2016 VM.

Note: this applies to Windows Server 2016 only. Win10 machine with GUI is not available in this size.

Provide some basic input, such as username and password you will use to connect to the VM.

The only machines with nested virtualization are D and E v3 machines. In MSDN you can consume up to 20 cores, therefore I selected D16S V3.

Select managed disks and also don't forget to enable Auto-Shutdown. Auto-Shutdown is really cool feature. Helps a lot managing costs of your lab.

Validate the settings and click on Create

Once VM will finish deploying, you will be able to see it running on your dashboard.

Adding premium disk (bit pricey)

Note: Premium disk is not the best choice as it drains your credit quite fast. So either use it and destroy, or use temp storage instead. You can store WSLab on OS and just copy to temp disk to deploy it there.

To add storage, click on add data disk under disks.

You will be able to specify disk. Since I did not have disk created, you can click on Create disk and wizard will open.

In wizard configure 4TB disk, just to have 7500 IOPS.

After disk is configured, you can configure host caching to Read/Write (since you don't care about loosing data)

Overall experience

I recommend using temp drive D: as its fast enough. After parent disk hydration, you can copy lab to c:\

Data disappeared after shutting down a VM

I prefer to keep WSLab on c:\ and copy it to temp drive on machine resume

In machine overview you are able to connect (after click it will download rdp file with server IP in it), or you can just copy IP to clip and run remote desktop client from your pc. To cut down cots, you can stop VM from here

Network is quite fast. Downloading image from eval center is ~ 200Mbits. I was able to see here also speeds around 500Mbits. I guess its because limited speed of source during the day in US.

Performance during file copy inside S2D cluster was quite impressive. Usually its around 200MB/s. On this screenshot you can see peak almost 800MB/s

Hydration of ws2016 lab took 81 minutes

DC and 4 s2d nodes takes 5,6 minutes

Scenario finishes in ~32 minutes

Enjoy!