SSH to AzureVM(packer node) using SSH keys instead of ssh_username and ssh_password

40 views
Skip to first unread message

Rajendra Kumar

unread,
Sep 26, 2019, 6:23:58 AM9/26/19
to Packer
Hi All,

Currently while baking azure vm using packer we give "ssh_username and ssh_password" in config.json, due to security concerns we want to use ssh keys to SSH into the azure packer node instead of  "ssh_username and ssh_password" . 

I could not find any packer variable where can I specify the SSH keys, and could not find any example config.json on the internet.

can somebody please help how can I achieve this, if possible please mention the steps and post the sample config.json.



Thanks in advance!
Rajendra




lovi

unread,
Sep 26, 2019, 9:24:25 AM9/26/19
to Packer

Rajendra Kumar

unread,
Sep 26, 2019, 10:47:26 AM9/26/19
to Packer
Thanks Lovi !!
So "ssh_private_key_file" is where we give the private key to authenticate, how can we mention the public key which gets attached to AzurevM(packer node) ? 

Like in AWS we can attach a pem file while launching the machine and in config.json we can send the private key to authenticate.

Packer variable for AWS ec2 builder 
"ssh_private_key_file" : "<private_key_file>",
"ssh_keypair_name" : "<key-pair-name-while-luanching-ec2-machine>",

Do we have something similar to aws ec2 builder ?

Shashank

unread,
Oct 5, 2019, 7:38:12 AM10/5/19
to Packer
You can simply skip ssh key file. If you skip this attribute, packer will create temporary key pair and use that for creating the image.
Reply all
Reply to author
Forward
0 new messages