How to deploy Linux in WVD when you can't deploy Linux in WVD

In my role as a Windows Virtual Desktop Global Black Belt at Microsoft working with customers deploying WVD, I often get asked can we deploy Linux in WVD?

The answer is no, but yes.

The official answer is we don't support Linux. In fact, this is the official list of operating systems that we support:




















So how can you run Linux in WVD?
Well this is a feature of Azure and Windows 10, not specifically WVD.


There are two options:

  1. Nested Virtualisation - i.e. running Hyper-V in an Azure VM
  2. Running Windows Subsystem for Linux on Windows 10. 
Both of these options will require the VM to be a WVD session host within a Host Pool.
To get this VM into WVD you can just follow the manual steps here: https://docs.microsoft.com/en-us/azure/virtual-desktop/create-host-pools-powershell, or just deploy a standard host pool as you normally would and complete these steps below after the host pool has been sucecsfully created.

Lets have a look at the first option.

1. Nested Virtualisation

This assumes you know a bit about Windows Virtual Desktop.
You can do this on either Windows Server or Windows 10.
Only "_V3" Azure VM's support nested virtualisation.

Windows Server

Deploy a standard WVD host pool using Windows Server, lets say Server 2016. Once you have logged into this VM run the followoing commands in an elevated PowerShell session:

Install the Hyper-V role:
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart

Create a new network Switch
New-VMSwitch -Name "InternalNAT" -SwitchType Internal

Get the Interface Index number - take a note of this number to use next
Get-NetAdapter

Set an IP Address and create the network:
New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceIndex 13
New-NetNat -Name "InternalNat" -InternalIPInterfaceAddressPrefix 192.168.0.0/24

Once this is complete you can then open up Hyper-V manager and create your "nested" VM, and this is where you create your Linux VM. This can be any distro. Just go and download the ISO file from the relevant website and create a new VM as per normal. 

In my example I have a WVD session aptly called "WVD-HyperV" and when I connect to the desktop I have Hyper-V running with a Ubuntu distro of Linux running as my nested VM:


























The beauty here is that you have two VM's for the price of one. We only charge per second that the first VM is powered on. This also applied regardless of how many nested VM's you run.

You can also install Hyper-V on Windows 10 by just installing the Hyper-V Feature, and then installing a nested VM in a similar manner to the above. The additional benefit of Windows 10 and Hyper-V is that you get the "Hyper-V Quick Create" feature:














Which as the name suggests will create one of four templated VM's for you automatically:

























Once this Quick Create has completed you again will have a Ubuntu 19.10 nested VM ready to go.

However, if you are doing this on Windows 10, you could also use the Windows Subsystem for 
Linux. This won't give you a full VM but does give you the Linux command line Interface.


2. Windows Subsystem for Linux

The second option is to install the Windows Subsytem for Linux on a Windows 10 session host.
This is even simpler.

First thing is to install the WSL: in an elevated Powershell session run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Once installed and rebooted, go to the Microsoft Store and search for Linux:


Then select your Linux Distribution you want - in my case Ubuntu 18.04 LTS:




Then click on Get or Install to install your choice:

Once installed you can run your distro from the published desktop, where you will likely need to complete some final installation configuration steps, but once complete you can now run Ubuntu in my case, in the Windows Subsytem for Linux:


























Once those final configuration tasks are complete you could also publish this as a WVD RemoteApp.
Trying to launch the app as a RemoteApp before completing the configuration steps fails.

Obviously you will need to find the executable for the distro that has been installed, as well as potentially creating your own icon if one has not
This is a command to publish Ubuntu via PowerShell:

New-RdsRemoteApp -tenantname "YourTenant" -hostpoolname "YourHostPool" -AppGroupName "YourRemoteAppGroup" -Name Ubuntu -FilePath "C:\Program Files\WindowsApps\CanonicalGroupLimited.Ubuntu18.04onWindows_2020.1804.7.0_x64__79rhkp1fndgsc\ubuntu1804.exe" -IconPath "C:\Program Files\WindowsApps\CanonicalGroupLimited.Ubuntu18.04onWindows_2020.1804.7.0_x64__79rhkp1fndgsc\Assets\Square44x44Logo.altform-unplated_targetsize-256.png"









Comments

Popular posts from this blog

Reassign a WVD Personal Session Host

AVD and Azure Active Directory Domain Join public preview

How to deploy a Windows Virtual Desktop host pool using Infrastructure as code from Azure DevOps