Create SSH keys with the Azure CLI - Azure Virtual Machines (2024)

  • Article

Applies to: ✔️ Linux VMs ✔️ Windows VMs ✔️ Flexible scale sets ✔️ Uniform scale sets

You can create SSH keys before creating a VM and store them in Azure. Each newly created SSH key is also stored locally.

If you have existing SSH keys, you can upload and store them in Azure for reuse.

For more information, see Detailed steps: Create and manage SSH keys for authentication to a Linux VM in Azure.

For more information on how to create and use SSH keys with Linux VMs, see Use SSH keys to connect to Linux VMs.

Note

ED25519 SSH key support for Linux VMs is now in preview in all regions including sovereign clouds.

Generate new keys

  1. After you sign in, use the az sshkey create command to create the new SSH key:

    az sshkey create --name "mySSHKey" --resource-group "myResourceGroup"
  2. The resulting output lists the new key files' paths:

    Private key is saved to "/home/user/.ssh/7777777777_9999999".Public key is saved to "/home/user/.ssh/7777777777_9999999.pub".
  3. Change the permissions for the private key file for privacy:

    chmod 600 /home/user/.ssh/7777777777_9999999

Connect to the VM

On your local computer, open a Bash prompt:

ssh -identity_file <path to the private key file> username@<ipaddress of the VM>

For example, enter: ssh -i /home/user/.ssh/mySSHKey [email protected]

Upload an SSH key

You can upload a public SSH key to store in Azure.

Use the az sshkey create command to upload an SSH public key by specifying its file:

az sshkey create --name "mySSHKey" --public-key "@/home/user/.ssh/7777777777_9999999.pub" --resource-group "myResourceGroup"

List keys

Use the az sshkey list command to list all public SSH keys, optionally specifying a resource group:

az sshkey list --resource-group "myResourceGroup"

Get the public key

Use the az sshkey show command to show the values of a public SSH key:

az sshkey show --name "mySSHKey" --resource-group "myResourceGroup"

Next steps

To learn more about how to use SSH keys with Azure VMs, see Use SSH keys to connect to Linux VMs.

Create SSH keys with the Azure CLI - Azure Virtual Machines (2024)
Top Articles
5 best Scandinavian countries for elite yet affordable education
Gewerbeanmeldung: Diese 6 Punkte sollten Sie wissen
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
Non Sequitur
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Pres. Carey Rath

Last Updated:

Views: 6070

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Pres. Carey Rath

Birthday: 1997-03-06

Address: 14955 Ledner Trail, East Rodrickfort, NE 85127-8369

Phone: +18682428114917

Job: National Technology Representative

Hobby: Sand art, Drama, Web surfing, Cycling, Brazilian jiu-jitsu, Leather crafting, Creative writing

Introduction: My name is Pres. Carey Rath, I am a faithful, funny, vast, joyous, lively, brave, glamorous person who loves writing and wants to share my knowledge and understanding with you.