Cannot SSH to Azure VM

I am adding this because it might help someone, the chosen answer did not work for me

for some reason the firewall on the ubuntu server

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

enter image description here


I encountered the same issue. The following is how I solve this issue:

  1. Don't add any port While creating your VM, do it only after only the VM is created
  2. Add the port 22 in the networking tab until the VM status is Running.

Looks to be an issue with the local firewall. Try resetting the SSH configuration in the portal.

  1. Go to Azure Portal
  2. Select VM in question
  3. Select Reset Password
  4. Select Reset Configuration Only
  5. Select Update

Screenshot of the process here!