Set up Start VM on Connect

Important

Start VM on Connect for Azure Stack HCI with Azure Virtual Desktop is currently in PREVIEW. See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.

Start VM On Connect lets you reduce costs by enabling end users to turn on their session host virtual machines (VMs) only when they need them. You can then turn off VMs when they're not needed.

You can configure Start VM on Connect for session hosts on Azure and Azure Stack HCI in personal or pooled host pools using the Azure portal or PowerShell. Start VM on Connect is a host pool setting.

For personal host pools, Start VM On Connect will only turn on an existing session host VM that has already been assigned or will be assigned to a user. For pooled host pools, Start VM On Connect will only turn on a session host VM when none are turned on and additional VMs will only be turned on when the first VM reaches the session limit.

The time it takes for a user to connect to a session host VM that is powered off (deallocated) 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 VM is being powered on while they're connecting.

Note

Azure Virtual Desktop (classic) doesn't support Start VM On Connect.

Prerequisites

To use Start VM on Connect, make sure you follow these guidelines:

  • You can only configure Start VM on Connect on existing host pools. You can't enable it at the same time you create a new host pool.
  • The following Remote Desktop clients support Start VM on Connect:
  • If you want to configure Start VM on Connect using PowerShell, you'll need to have the Az.DesktopVirtualization PowerShell module (version 2.1.0 or later) installed on the device you use to run the commands.
  • You must grant Azure Virtual Desktop access to power on session host VMs, check their status, and report diagnostic information. You must have the Microsoft.Authorization/roleAssignments/write permission on your subscriptions in order to assign the role-based access control (RBAC) role for the Azure Virtual Desktop service principal on those subscriptions. This is part of User Access Administrator and Owner built in roles.
  • If you enable Start VM on Connect on a host pool, you must make sure that the host pool name, the names of the session hosts in that host pool, and the resource group name don't have non-ANSI characters. If their names contain non-ANSI characters, then Start VM on Connect won't work as expected.

Assign the Desktop Virtualization Power On Contributor role with the Azure portal

Before you can configure Start VM on Connect, you'll need to assign the Desktop Virtualization Power On Contributor role-based access control (RBAC) role to the Azure Virtual Desktop service principal with your Azure subscription as the assignable scope. Assigning this role at any level lower than your subscription, such as the resource group, host pool, or VM, will prevent Start VM on Connect from working properly.

You'll need to add each Azure subscription as an assignable scope that contains host pools and session host VMs you want to use with Start VM on Connect. This role and assignment will allow Azure Virtual Desktop to power on VMs, check their status, and report diagnostic information in those subscriptions.

To learn how to assign the Desktop Virtualization Power On Contributor role to the Azure Virtual Desktop service principal, see Assign RBAC roles to the Azure Virtual Desktop service principal.

Enable or disable Start VM on Connect

Now that you've assigned the Desktop Virtualization Power On Contributor role to the service principal on your subscriptions, you can configure Start VM on Connect using the Azure portal or PowerShell.

To configure Start VM on Connect using the Azure portal:

  1. Sign in to the Azure portal.

  2. In the search bar, enter Azure Virtual Desktop and select the matching service entry.

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

  4. Select Properties.

  5. In the configuration section, you'll see Start VM on connect. Select Yes to enable it, or No to disable it.

  6. Select Save to apply the settings.

Note

In pooled host pools, Start VM on Connect will start a VM every five minutes at most. If other users try to sign in during this five-minute period while there aren't any available resources, Start VM on Connect won't start a new VM. Instead, the users trying to sign in will receive an error message that says, "No resources available."

Troubleshooting

If you run into any issues with Start VM On Connect, 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 make a note of the error name for reference. You can also use Azure Virtual Desktop Insights to get suggestions for how to resolve issues.

If the session host VM doesn't turn on, you'll need to check the health of the VM you tried to turn on as a first step.

Note

Connecting to a session host outside of Azure Virtual Desktop that is powered off, such as by using the MSTSC client, won't start the VM.

For other questions, check out the Start VM on Connect FAQ.

Next steps

For more information about Start VM on Connect, see our Start VM on Connect FAQ.