How can I setup SSH key for an existing Azure linux VM

Ashitha S 96 Reputation points
2023-02-09T08:54:47.02+00:00

I need to create a ssh key for authentication instead of password for a linux VM. Note that the linux VM already has a username password created while creating the VM. But i can delete the username/password using Azure cloudshell. I need to know how i can create a key for this VM now that can be used as authentication. Please give me the steps or docs.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,013 questions
{count} votes

2 answers

Sort by: Most helpful
  1. TP 124.7K Reputation points Volunteer Moderator
    2023-02-09T09:15:25.39+00:00

    Hi,

    To use cloud shell/cli to create SSH key please see this article:

    Manage administrative users, SSH, and check or repair disks on Linux VMs using the VMAccess Extension with the Azure CLI

    https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/vmaccess#update-ssh-key

    To use portal to create SSH key please see this article:

    Troubleshoot SSH connections to an Azure Linux VM that fails, errors out, or is refused

    https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection#use-the-azure-portal

    If the above was helpful please click Accept Answer.

    Thanks.

    -TP

    0 comments No comments

  2. Auon Ali Khowaja 0 Reputation points
    2023-02-09T12:58:04.6966667+00:00

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.