Virtual Desktop Streamer startup

Start Virtual Machine on Connect

In this article

The Start Virtual Machine (VM) on Connect feature lets you save costs by allowing end users to turn on their VMs only when they need them. You can then turn off VMs when they're not needed.

Note

Azure Virtual Desktop (classic) doesn't support this feature.

Requirements and limitations

You can enable the start VM on Connect feature for personal or pooled host pools using PowerShell and the Azure portal.

The following Remote Desktop clients support the Start VM on Connect feature:

  • The web client
  • The Windows client (version 1.2.2061 or later)
  • The Android client (version 10.0.10 or later)
  • The macOS client (version 10.6.4 or later)
  • The iOS client (version 10.2.5 or later)
  • The Microsoft Store client (version 10.2.2005.0 or later)
  • The thin clients listed in Thin client support

Create a custom role for Start VM on Connect

Before you can configure the Start VM on Connect feature, you'll need to assign your VM a custom RBAC (role-based access control) role. This role will let Azure Virtual Desktop manage the VMs in your subscription. You can also use this role to turn on VMs, check their status, and report diagnostic info. If you want to know more about what each role does, take a look at Azure custom roles.

Note

If your VMs and host pool are in different subscriptions, the RBAC role needs to be assigned to the subscription that the VMs are in.

Use the Azure portal

To use the Azure portal to assign a custom role for Start VM on Connect:

  1. Open the Azure portal and go to Subscriptions.

  2. Select the subscription that your VMs are in.

  3. Go to Access control (IAM) and select Add a custom role.

    Virtual Desktop Streamer startup

  4. Next, name the custom role and add a description. We recommend you name it start VM on connect.

  5. On the Permissions tab, add one of the two following sets of permissions to the subscription you're assigning the role to:

    • Microsoft.Compute/virtualMachines/start/action
    • Microsoft.Compute/virtualMachines/read
    • Microsoft.Compute/virtualMachines/instanceView/read

    You can also use these permissions instead:

    • Microsoft.Compute/virtualMachines/start/action
    • Microsoft.Compute/virtualMachines/*/read
  6. When you're finished, select Ok.

After that, you'll need to assign the role to grant access to Azure Virtual Desktop.

To assign the custom role:

  1. In the Access control (IAM) tab, select Add role assignments.

  2. Select the role you just created.

  3. In the search bar, enter and select Windows Virtual Desktop (this will soon be updated to "Azure Virtual Desktop").

    Note

    You might see two apps if you have deployed Azure Virtual Desktop (classic). Assign the role to both apps you see.

    Virtual Desktop Streamer startup

Create a custom role with a JSON file template

If you're using a JSON file to create the custom role, the following example shows a basic template you can use. Make sure you replace the subscription ID value in AssignableScopes with the subscription ID you want to assign the role to.

{ "Name": "Start VM on connect (Custom)", "IsCustom": true, "Description": "Start VM on connect with AVD (Custom)", "Actions": [ "Microsoft.Compute/virtualMachines/start/action", "Microsoft.Compute/virtualMachines/*/read" ], "NotActions": [], "DataActions": [], "NotDataActions": [], "AssignableScopes": [ "/subscriptions/00000000-0000-0000-0000-000000000000" ] }

To use the JSON template, save the JSON file, add the relevant subscription information to Assignable Scopes, then run the following cmdlet in PowerShell:

New-AzRoleDefinition -InputFile "C:\temp\filename"

To learn more about creating custom roles, see Create or update Azure custom roles using Azure PowerShell.

Configure the Start VM on Connect feature

Now that you've assigned your subscription the role, it's time to configure the Start VM on Connect feature!

Deployment considerations

Start VM on Connect is a host pool setting. If you only want a select group of users to use this feature, make sure you only assign the required role to the users you want to add.

For personal desktops, the feature will only turn on an existing VM that the service has already assigned or will assign to a user. In a pooled host pool scenario, the service will only turn on a VM when none are turned on. The feature will only turn on additional VMs when the first VM reaches the session limit.

Important

You can only configure this feature in existing host pools. This feature isn't available when you create a new host pool.

Use the Azure portal

To use the Azure portal to configure Start VM on Connect:

  1. Open your browser and go to the Azure portal.

  2. In the Azure portal, go to Azure Virtual Desktop.

  3. Select Host pools, then go to the host pool where you want to enable the setting.

  4. In the host pool, select Properties. Under Start VM on connect, select Yes, then select Save to instantly apply the setting.

    Virtual Desktop Streamer startup

Use PowerShell

To configure this setting with PowerShell, you need to make sure you have the names of the resource group and host pools you want to configure. You'll also need to install the Azure PowerShell module (version 2.1.0 or later).

To configure Start VM on Connect using PowerShell:

  1. Open a PowerShell command window.

  2. Run the following cmdlet to enable Start VM on Connect:

    Update-AzWvdHostPool -ResourceGroupName -Name -StartVMOnConnect:$true
  3. Run the following cmdlet to disable Start VM on Connect:

    Update-AzWvdHostPool -ResourceGroupName -Name -StartVMOnConnect:$false

User experience

In typical sessions, the time it takes for a user to connect to a deallocated VM increases because the VM needs time to turn on again, much like turning on a physical computer. The Remote Desktop client has an indicator that lets the user know the PC is being powered on while they're connecting.

Troubleshooting

If the feature runs into any issues, we recommend you use the Azure Virtual Desktop diagnostics feature to check for problems. If you receive an error message, make sure to pay close attention to the message content and copy down the error name somewhere for reference.

You can also use Azure Monitor for Azure Virtual Desktop to get suggestions for how to resolve issues.

If the VM doesn't turn on, you'll need to check the health of the VM you tried to turn on before you do anything else.

Next steps

If you run into any issues that the troubleshooting documentation or the diagnostics feature couldn't solve, check out the Start VM on Connect FAQ.