Problem:
When connecting to an Azure Virtual Machine over RDP, you receive one of the following errors:
Azure Bastion
The connection has been closed because the target machine is taking too long to respond. This is usually caused by network problems, such as a spotty wireless signal, or slow network speeds. Please check your network connection and try again or contact your system administrator.
Remote Desktop Connection
Remote Desktop can’t connect to the remote computer for one of these reason
- remote access to the server is not enabled
- the remote computer is turned off
- the remote computer is not available on the network
Make sure the remote computer is turned on and connected to the network, and that remote access is enabled.
Solution:
The Hyper-V Generation between your Azure Managed Image / Snapshot and Azure Virtual Machine conflicts. Redeploy your Azure Virtual Machine using the correct Hyper-V Generation of the image.
Explanation:
Recently I was helping a customer deploy an Azure VM from a snapshot. The reference script on Microsoft’s Docs page works perfectly if your snapshot was created from a Hyper-V Generation 1 virtual machine. However, if your snapshot was created from a Gen 2 virtual machine, there’s a missing parameter. To ensure your VM is created using the appropriate Hyper-V Generation, be sure to specify the “HyperVGeneration” parameter with the New-AzDiskConfig cmdlet.