Marcel
Marcel That's me: Marcel

Session hosts are not available in Azure Virtual Desktop, but VMs are running.

Session hosts are not available in Azure Virtual Desktop, but VMs are running.

During June/July, I got several emails that session hosts were not available in AVD, but the VMs were in a running state. Rebooting the host sometimes helps, and the host was shown as available. We figured out that the issue was caused by a not running RDAgentBootLoader service on affected hosts. Starting the service (or the host) resolved the issue. Right now, I don’t know the root cause of why the RDAgentBootLoader was not started or failed.

To workaround this behavior by implementing a scheduled task, start with the host and monitors the service for the first 30 minutes. The service will be started if it’s not running.

The scheduled task will automatically be created for new deployments with Hydra for Azure Virtual Desktop or WVDAdmin) from version 06/27/2023.

If you want to build your own scheduled task, you can use this script:

	$interval=30
	$run=$true
	$counter=0
	$serviceName="RDAgentBootLoader"
	do {
		Start-Sleep -Seconds $interval
		$service=Get-Service -Name $serviceName -ErrorAction SilentlyContinue
		if ($service -ne $null -and $service.Status -ne [System.ServiceProcess.ServiceControllerStatus](4)) {
			Write-Host "Starting service: $serviceName"
			Start-Service -Name $serviceName -ErrorAction SilentlyContinue
		}
		$counter++
		if ($counter -gt 10) {$interval=90}
		if ($counter -gt 20) {$run=$false}
	} while ($run)

PS: Maybe it makes sense to monitor the service during the runtime of the VM in the future.