Azure - SSH troubleshooting

About

When you can't connect to your machine via SSH.

Steps

The documentation

  • Go to the Azure Portal
  • Select your machine
  • Select “Diagnose and solve problems”
  • Wait a little bit
  • Select “I can't connect to my Linux VM”

_

The VM is running ?

_

Verify if your VM is running by viewing your VM's console screenshot or logs.

Boot diagnostic

  • Enable the Boot Diagnostics. (Vm> Support + Troubleshooting sub-header > Boot Diagnostic > Diagnostic Settings)

To store boot diagnostics for a VM, you need a storage account. These boot diagnostics can help you troubleshoot problems and monitor the status of your VM. The storage account you create is only to store the boot diagnostics data.

_

  • Restart the machine
  • Check the log. Review errors in the logs such as:

_

Review effective security group rules

_

Reset Ssh Configuration

  • Azure portal > Support + Troubleshooting section > Reset password
  • Or with the Azure Cli
    • Create the file reset_sshd.json
{
    "reset_ssh":"True"
}
  • Execute the following command
az.cmd vm extension set \
  --resource-group resourceGroupName \
  --vm-name vmName \
  --name VMAccessForLinux \
  --publisher Microsoft.OSTCExtensions \
  --version 1.4 \
  --protected-settings reset_sshd.json

Redeploy

Address any Azure host issues by redeploying, which will migrate the VM to a new Azure host

_

Documentation / Reference


Powered by ComboStrap