Initializing Azure Virtual Desktop User Sessions Remotely

jayllan abecia 0 Reputation points
2023-02-01T14:51:25+00:00

Hi Team, we are starting and shutting down our AVD daily to lessen the cost. the AVD user session is configured to run applications during the initialization of the session which takes a few minutes to finish.

is there a way to login and initialize the AVD user sessions in advance every time the session is started to avoid the long waiting time be it via ansible or azure automation runbook.

Best regards,

Jayllan

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,113 questions
Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,362 questions
Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
4,234 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. srbhatta-MSFT 8,546 Reputation points Microsoft Employee
    2023-02-01T20:28:56.2133333+00:00

    Hello @jayllan abecia ,

    Welcome to Microsoft QnA.

    Yes, you can use Azure Automation Runbook to initialize your Azure Virtual Desktop (AVD) user sessions in advance.

    You can create a PowerShell runbook that starts the AVD user session automatically. You can schedule the runbook to run at a specific time every day, so the AVD user session will be ready and initialized before you need it, thereby avoiding the long waiting time.

    Here's what you can do:

    1. Create an Azure Automation Account and import the Azure Virtual Desktop module into it.
    2. Create a new PowerShell runbook and paste the following code into it, replacing the placeholders with your specific values:
    $SessionHostName = "AVD_Session_Host_Name"
    $UserUPN = "User_UPN"
    $Password = ConvertTo-SecureString "Password" -AsPlainText -Force
    $Credential = New-Object System.Management.Automation.PSCredential($UserUPN, $Password)
    
    Import-Module Microsoft.RDInfra.RDPowershell
    
    Start-RDUserSession -HostPoolName "AVD_Host_Pool_Name" -SessionHostName $SessionHostName -UserUpn $UserUPN -Credential $Credential
    
    1. Save and publish the runbook.
    2. Schedule the runbook to run at a specific time every day using the Azure Automation Schedule.

    Hope this helps. Do reply back and let me know if you have any further questions :)

    Please "accept as answer" if the above information is helpful.