Start VM on Connect for Pooled Session Hosts! (Preview)

In todays blog I am going to be quickly demonstrating the new Start VM on Connect feature.

Now this feature has been available (in Preview) for Personal Host Pools for a while. But now Microsoft have announced that it can be used for Pooled Session Hosts!

Now for my situation this is perfect. I want to have a low number of VMs available and power on more as the existing Session Hosts are filled up.

Now this won’t be perfect for all pooled environments as it will 100% depend on the access requirements.

If you have hundreds of users then I wouldn’t rely on Start VM on Connect to be a good choice. In my environment it will be useful for out-of-hours workers if there is a sudden surge of access over our normal reduced usage.

Instructions

RBAC Role

In order for WVD to be able to auto start the Session Hosts, we need to configure the relevant RBAC permissions for it.

It will require the ability to Read (or get) Virtual Machine information, as well as the Start Virtual Machine action.

Under the Subscriptions blade, find you subscription and then click the Access control (IAM) tab.

Now click + Add and select Add custom role

Give a relevant name (something like Start VM on Connect) and click Next

On the Permissions tab click Add permissions

Locate the Microsoft Compute provider

Locate the following permissions and click Add

Check the permissions look right then click Review + create then Create

We now need to assign this custom role to the Windows Virtual Desktop service.

Back in the Subscription tab click + Add and select Add role assignment

Select the new custom role from the drop down, and assign to the Windows Virtual Desktop service. Then click Save

N.B: You may need to wait a few minutes for the new role to add. If the custom role does not show try again.

Update Host Pool (PowerShell)

We now need to configure the Start VM on Connect feature, unfortunately at the moment you cannot configure this via the Azure Portal. Instead you need to do a very simple bit of PowerShell to enable it.

Firstly, ensure you have the Azure Az Powershell module and the Az.DesktopVirtualization module. They can be found in the below links:

Introducing the Azure Az PowerShell module | Microsoft Docs

PowerShell Gallery | Az.DesktopVirtualization 2.0.1

Open up a PowerShell window and connect to your Azure Account.

Connect-AzAccount

I’m going to get the details for my Host Pool

Get-AzWVDHostPool -ResourceGroup <resourceGroup> | fl

We can see that the StartVMOnConnect property is there, but set as False. Let’s change that.

Run the following PowerShell to enable this feature.

Update-AzWVDHostPool -ResourceGroup <resourceGroup> -HostPoolName <HostPoolName> -StartVMOnConnect:$true

If we now check the host pool properties again it will now show true for StartVMOnConnect

Testing

Now time to test!

So first, let’s check the Session Host is not powered on.

Now lets try and connect and see what happens. . . .

Sure enough its started my machine. It took about 1 minute!

You’ll then see

And . . . . . we’re in!

Thoughts

Personally I found this incredibly easy to setup and it seems to work rather well.

The obvious caveats are that it is a preview feature so be aware that its not production ready and it may not be suitable for massive Host Pools with hundred of users frequently logging in.

The speed to login will basically be the normal login with the additional time it take the Session Host to power on.

Of note, if you have multiple Session Hosts it will only initiate a Start VM on Connect if the existing Session Hosts have hit their Max Session count.

Overall another good addition to WVD. Keep them coming MS!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s