Hi,
When you see connection timeout, you can check the boot diagnostics to see if the console is showing the login screen. If yes, then you will need to check your NSG to make sure SSH/RDP access to the VM is allowed.
Here is the doc for your reference: https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/troubleshoot-rdp-connection
Regards,
Karthik Srinivas