Hello @TedNjiru
I completely understand how frustrating it can be when working VM breaks in between and troubleshooting also doesn't help to fix the issue, from the overview it seems like you have already tried the basic SSH troubleshooting guide: https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/linux/troubleshoot-ssh-connection#quick-troubleshooting-steps (this includes resetting SSHD, reset credentials for ssh user, rebooting, redeploying, stop+start for the VM)
I'm listing out few more troubleshooting steps, kind review them in case not reviewed already:
- Verify if the Agent is in Ready state (Goto Azure Portal -> Virtual Machines -> Impacted VM -> Settings -> Properties -> Look for Agent Status (it should show status as "Ready").
- Since you already have reviewed Networking options and didn't find any issue.
It'll be helpful if you could try "IP flow verify" in the Network Watcher.
This will help to find out if a packet is allowed or denied to or from an Azure virtual machine based on the configured security and admin rules.
Refer here for more info ->https://learn.microsoft.com/en-us/azure/network-watcher/ip-flow-verify-overview - Check Boot Diagnostics: Check Screenshot of the VM, this will help to know if OS is booting up in the VM or if it's throwing any error.
How to check it : Goto Azure Portal-> Virtual Machines -> Impacted VM -> Under Help -> Boot Diagnostics -> Screenshot
For my working VM, it shows something like below:
- If OS is not booting you can check Serial log to see what error messages show up when the OS is not booting. (Option right of Screenshot)
- If OS is booting then you can try to connect to the VM using Serial Console.
Where to find:- Goto Azure Portal -> Virtual Machines -> Impacted VM -> Help -> Serial Console. - After logging into the Serial Console, you can look for Guest OS firewall rules (for example if you are using Ubuntu, you can look for ufw firewall rules.
See here: https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/linux/ubuntu-ufw-guide?tabs=netstat#how-to-check-whether-a-port-is-closed-in-the-ubuntu-vm-with-ufw)
If none of the above steps help, please share results of all these steps, it'll help us to understand where SSH failing for you, and we can assist you further to fix the issue.
Additionally, could you please answer below queries to understand your setup for SSH:
- Are you trying to login using local admin user with password configured for the VM or are you using Entra users to ssh to the VM?
- Are you using some tool like Putty to SSH?
- Are you trying to SSH from a local machine (if yes, try SSH from Azure Console or to connect VM using Bastion as well and see if it works), using command :
ssh username@publicIP? - Is your network part of some office network (this might have firewalls or routing rules defined or restrictions placed over the network, if yes try changing the network for your source machine as well)