@SaidAlisic This article helps you find and correct the problems that occur due to Secure Shell (SSH) errors, SSH connection failures, or SSH is refused when you try to connect to a virtual machine (VM): https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshoot-ssh-connection
There is also similar discussion thread here, please refer to the suggestion and let us know the status
- Also check if Port 22 is Enabled/Allow on "default-allow-ssh" under "Inbound Port Rules". (Path: Dashboard > Select your VM > Networking (under Settings section)
- Go to Serial Console type in your ssh username and you will be logged into the server
Check the firewall status to see if port 22 is allowed
sudo ufw status verbose
If the rule is not there then add it
sudo ufw allow ssh
Azure VM and ssh connection: test succeeded but PuTTY timed out
Also, to isolate the issue further you may take a look into the detailed troubleshooting steps outlined in the documentation Detailed SSH troubleshooting steps for issues connecting to a VM in Azure, and let us know how it goes.
Hope this helps!
Kindly let us know if the above helps or you need further assistance on this issue.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Please don’t forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.