StartVMOnConnect

Microsoft has released “Start VM on Connect” feature for personal desktops. What does this mean to users and administrators?. The Personal desktop will automatically start once user initiates a connection to the VM which means you don’t want to configure power management to adjust the user’s login time.

This feature is currently available only on Webclient and Windows Remote desktop Client

Let us see how we can configure this feature in personal host pool.

The process involves two steps:-

  • Enable the feature on your Personal desktop hostpool
  • Create a custom role which can Read and start the VM and assign it to the WVD SPN.

Enable the feature on Hostpool

Open Cloud shell, and execute the below command to enable startvmonconnect feature on your PD host pool.

Update-azwvdhostpool -resourcegroupname <RGname> -hostpoolname <hostpool> -startvmonconnect:$true
Machine generated alternative text:
PS /home/amal> Update-AzWvdHostP001 
-ResourceGroupName 
-HostP001Name wvd-personal 
- StartVMOnConnect : $true 
Location 
Name 
Type 
northeurope wvd-personal Microsoft. DesktopVirtua1ization/hostp001s

Create a Custom Role

The second thing we need to do is to create a custom role with permissions to start the Virtual machine.

Go to subscriptions–>IAM. Click on “+Add” and from the drop down, select “Add custom Role”

Machine generated alternative text:
-k Add Download role assignment 
Add role assignment 
Its 
Add co-administrator 
Add custom role 
View my level of access to this resource.

Provide name for your role and Click Next

Machine generated alternative text:
Basics 
Permissions 
Assignable scopes 
JSON 
Review + create 
To create a custom role for Azure resources, fill out some basic information. Learn more cd' 
Custom role name O 
Description 
Baseline permissions O 
C) Clone a role 
@ Start from scratch 
C) Start from JSON

Select the permissions shown in the screenshot and Click Next

Machine generated alternative text:
Basics 
Permissions 
-f- Add permissions 
Assignable scopes 
JSON 
-F Exclude permissions 
Review + create 
Click Add permissions to select the permissions you want to add to this custom role. 
To add a wildcard (*) permission, you must manually add the permission on the JSON tab. Learn more cd' 
To exclude specific permissions from a wildcard permission, click Exclude permissions. Learn more cd' 
Permission 
Microsoft.Compute/virtualMachines/start/action 
Microsoft.Compute/virtualMachines/read 
Description 
Starts the virtual machine 
Get the properties of a virtual mac... 
Permission type 
Action 
Action

By default the scope is on whole subscription, please modify it if you want to target this role for specific Resource groups. Click on review and Create.

Machine generated alternative text:
Basics 
Permissions Assignable scopes 
-k Add assignable scopes 
JSON 
Review + create 
Click Add assignable scopes to select the scopes (subscriptions or resource groups) where this role v 
least one assignable scope. Learn more cd' 
Assignable scope

The JSON file is uploaded in the Repo and can be downloaded from here.

Add Role Assignment

Go to subscriptions–>IAM. Click on “+Add” and from the drop down, select “Add role assignment”

Machine generated alternative text:
-k Add Download role E 
Add role assignment 
Add co-administrator 
Add custom role

Select the role you created in the previous step from the drop down, and type “Windows virtual desktop” to get the SPN for WVD . Select the WVD SPN and click on Add role.

Machine generated alternative text:
Add role assignment 
Role O 
WVD Start on Connect O 
Assign access to O 
User, group, or service principal 
Select O 
windows virtual desktop 
Windows Virtual Desktop ARM Provider 
Windows Virtual Desktop Client 
Selected members: 
Windows Virtual Desktop 
Remove

Test the functionality

You are all set to test the “VMStartOnConnect” feature. Access the personal desktop from Remote Desktop Client and you can see the dialogue that “Starting Remote PC” if your PD WVD is in shutdown state.

Machine generated alternative text:
Remote Desktop 
Connecting to: 
Session Desktop 
Starting remote PC__ 
x 
Cancel

Please let me know if you have any questions or queries.

One thought on “StartVMOnConnect

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