Re-registering an AVD Session Host After a Host Pool Outage
One of the more confusing Azure Virtual Desktop issues is when a session host drops out of the host pool and refuses to register again.
) {
New-Item -Path $path -Force | Out-Null
}
Set-ItemProperty -Path $path -Name "IsRegistered" -Value 0 -Force
Set-ItemProperty -Path $path -Name "RegistrationToken" -Value $RegistrationToken -Force
Restart-Service RDAgentBootLoader -Force
Start-Sleep -Seconds 45
Write-Output "RDInfraAgent registry state:"
Get-ItemProperty -Path $path -Name IsRegistered | Select-Object IsRegistered
Get-ItemProperty -Path $path -Name RegistrationToken | Select-Object RegistrationToken
Write-Output "Services:"
Get-Service RDAgentBootLoader, RDAgent | Select-Object Name, Status
This script is meant to run directly on the VM. If you use Azure Portal Run command, paste only the PowerShell above. Do not wrap it in Invoke-AzVMRunCommand.
Why the old name causes the failure
The agent is not only checking whether it has a token. It is also trying to register itself as a session host in the target host pool. If the previous record with the same name is still there, Azure Virtual Desktop treats that as an existing object and rejects the new registration attempt.
That is why simply updating the token often does not solve the issue.
The conflict must be removed first, then the VM can register cleanly.
Prevention
If you keep AVD session hosts powered off for long periods, do not leave them completely offline for more than 90 days.
A more practical rule is to start them every 60 or 75 days and let them run for 20 to 30 minutes. That simple maintenance window is usually enough to avoid falling too far out of sync and reduces the chance of registration issues later.
Final note
If a session host falls out of an AVD host pool and you need to re-register it, always check for the old host name first. In this case the working fix is not just “generate a new token and retry”. The safe order is:
- remove the stale session host entry
- generate a new registration token
- re-register the VM
That sequence avoids the name collision and usually brings the host back into the pool cleanly.