DEV Community

Cover image for Creating and Connecting to a Linux VM using a Public Key
Otitoju Mercy
Otitoju Mercy

Posted on

Creating and Connecting to a Linux VM using a Public Key

Step 1: Create a Linux VM on Azure

  • Log in to the Azure portal and navigate to the Virtual Machines page

Image description

  • Click "Create a virtual machine" and select "Linux" as the operating system.
  • Choose a Linux distribution (e.g., Ubuntu) and configure the VM settings as desired.

Image description

  • In the "Authentication" section, select "SSH public key" and paste the contents of your public key file (mykey.pub)

Image description.

Step 2: Connect to the Linux VM using SSH

  • Once the VM is created, navigate to the VM's overview page and click "Connect".

Image description

  • Select "SSH" as the connection method.
  • In the SSH connection dialog, enter the username and private key file (mykey) .
  • Click "Connect" to establish the SSH connection.

Image description

Step 3: Verify the Connection

  • Once connected, you should see a terminal prompt for the Linux VM.
  • Run the command using Window PowerShell -a to verify that you are connected to the Linux VM.

Image description

That's it! You have successfully created and connected to a Linux VM using a public key.

Image description

Note: This is just a general outline, and specific steps may vary depending on your Azure subscription and VM configuration.

Top comments (0)