Azure - Machine SSH not available
This article provides some resolution steps in case your machine is running but refusing SSH access. This kind of issue can be resolved through the Azure portal directly.
1 - Context
It may happen after restarting or booting an existing virtual machine that your machine refuses SSH access even though Azure indicates that your machine is running. This issue does not necessarily mean that your machine is having troubles and/or is down and may only be due to the main SSH service being not started properly.
If you try to connect to the machine via SSH it is likely that you will see this type of error (note the "-vvv" to be able full verbose mode):
ssh -vvv myuser@mymachine # => ssh_exchange_identification: Connection closed by remote host
If you are using Ruby to connect to the machine - e.g. from the Nex!™ orchestrator - you will likely see errors like:
Net::SSH::Disconnect: connection closed by remote host
2 - Resolution steps
In order to resolve the problem above you can follow the steps below
- Go to Azure portal
- Select the machine you have troubles with
- Go to the Reset Password section
- Select Reset Configuration Only in the dropdown
- Wait for the SSH reset to be done
- Try to SSH again to the machine
If the above does not work you can try to do a full SSH reset by entering a new SSH key
- Go to the Reset Password section
- Select Reset SSH Public Key in the dropdown
- Enter the new SSH public key for your machine and click save
- Wait for the SSH reset to be done
- Try to SSH again to the machine
3 - Reference article
Original article: https://docs.microsoft.com/en-gb/azure/virtual-machines/linux/troubleshoot-ssh-connection#fix-common-ssh-errors