I am sorry to hear you lost connection to your VM.
Error message what you posted above is the general one and could have many root causes.
Did you do any changes on the VM before you lost connection?
First, I'd check if VM is fully booted. If you cannot connect to your Windows virtual machine (VM) and are unsure of the cause, you can start by accessing the Boot Diagnostics Screenshot for your VM and determine if the VM is experiencing a boot error.
If your VM is not at the ctrl-alt-del screen, it may be experiencing a boot error
- Restart the virtual machine to address boot issues by clicking Restart at the top of the VM resource blade
- If your VM fails to start and you recently applied Windows Updates please see Troubleshooting VM not booting after Windows Update
- Review the common boot errors and solutions for non-bootable VMs troubleshooting guide
VM is at the ctrl-alt-del screen - issues external to the VM (Load Balancer, NSG, ExpressRoute)
Use Network Watcher to help diagnose connectivity issues to your VM.
VM is at the ctrl-alt-del screen - issues internal to the VM
- Resetting your VMs RDP configuration here or by following instructions in the guide: Reset Remote Access to address RDP issues using PowerShell or CLI
- If your VM has booted into Safe Mode, follow VM boots into Safe Mode
- If you are seeing a red X over the network icon on the screenshot, follow Cannot connect due to netvsc.sys issue
- If your network interface card (NIC) in the guest OS may be disabled or misconfigured, follow NIC disabled in guest OS
- Verify if the guest OS firewall is misconfigured
- Disable the guest OS Firewall in Azure VM
- Enable or disable a firewall rule on an Azure VM Guest OS
- Azure VM Guest OS firewall is blocking all inbound traffic
If you still are encountering RDP errors
- Basic RDP Troubleshooting in Azure VMs
- Troubleshooting general RDP errors in Azure VMs
- The Remote Desktop license server is not available when you connect via RDP to an Azure VM
- Review the common RDP errors and solutions for Azure VMs
Hope above information is good for you to resolve the issue.