I can't ssh into the VMSS node instance

John Jones 0 Reputation points
2025-02-13T04:51:38.1233333+00:00

Hi,

I have set up a Bastion and have created ssh key pair.
Have added the public key to the vmss instance via azure cli.
I went to Azure Portal and was trying to access the VMSS instance using the private key I have and azureuser username but it just says "Login Failed. Please reconnect and try again."
The port 22 is enabled in the NSG.
Also I have tried to enable diagnostic logs on Bastion in hope that I can see why the login has failed but when I run query in the "Logs" section on Bastion I get this error:

'where' operator: Failed to resolve table or column expression named 'SigninLogs' Request id: 273671b9-4a87-491d-a103-2efc757df35c

Also I have set up this:

  • Reader role on the virtual machine.
  • Reader role on the NIC with private IP of the virtual machine.
  • Reader role on the Azure Bastion resource.
  • Reader role on the virtual network of the target virtual machine (if the Bastion deployment is in a peered virtual network).
Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
431 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nikhil Duserla 4,515 Reputation points Microsoft Vendor
    2025-02-13T12:21:36.0833333+00:00

    Hi John Jones,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    We understand from your query that you are experiencing an issue while trying to SSH into the VM. I would recommend trying to connect using a different network (ISP). I have set up the same environment in my tenant, and I am able to access the VM using Bastion and CLI.

    Firstly, I created a VMSS with an SSH public key and navigated to the instances. Select the instance you want to open, then click on the 'Connect' dropdown and choose 'Bastion.' Click 'Deploy Bastion' and wait until it’s deployed. Once deployed, select 'Authentication Type' as SSH Private Key from Local File. The username should be the same as when you created the instance. For 'Local File,' provide the path to the SSH private key, mark 'Open in new browser tab,' and click 'Connect. User's imageUser's image

    Workaround by using CLI to access VMSS VM:

    If you don't have associated earlier, add Public IP to instance. move Private Key to ssh path using below command mv /Downloads/myKey.pem ~/.ssh

    Try accessing by using this command ssh -i ~/.ssh/key name username@Public IP

    Please go through this link for more detailed steps- https://learn.microsoft.com/en-us/azure/virtual-machines/linux-vm-connect?tabs=Linux#connect-to-the-vm

    If you found this informative, please consider accepting an answer as a token of appreciation. And don't forget to give it a thumbs up 👍 if it was helpful.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.