hashicorp / packer-plugin-azure

Packer plugin for Azure Virtual Machine Image Builders
https://www.packer.io/docs/builders/azure
Mozilla Public License 2.0
48 stars 76 forks source link

Packer vm password gets changed #208

Open rahulnegirock opened 2 years ago

rahulnegirock commented 2 years ago

Hi Team, I’m trying to build resource via packer builders “type”: “azure-arm”, and what is happening that using ssh_password, the existing user password is getting changed and later am unable to ssh into that machine using the same ssh_password which I passed in config. Although ssh_username sets the username but it seems password is generated randomly or getting changed automatically. So, Is it the expected behavior or I am missing something. Please help or consult. Below is the builder section for reference

“builders”: [ { “type”: “azure-arm”, “use_azure_cli_auth”: “True”, “os_type”: “Linux”,

"shared_image_gallery": {
  "subscription": "{{user `subscription_id`}}",
  "resource_group": "{{user `sig_gallery_resource_group`}}",
  "gallery_name": "{{user `sig_gallery_name`}}",
  "image_name": "{{user `sig_image_name`}}",
  "image_version": "{{user `sig_source_image_version`}}"
},

"shared_image_gallery_destination": {
  "subscription": "{{user `subscription_id`}}",
  "resource_group": "{{user `sig_gallery_resource_group`}}",
  "gallery_name": "{{user `sig_gallery_name`}}",
  "image_name": "{{user `sig_image_name`}}",
  "image_version": "{{user `sig_dest_image_version`}}",
  "replication_regions": ["{{user `location`}}"]
},

"temp_resource_group_name": "{{user `temp_resource_group_name`}}",
"temp_compute_name": "{{user `temp_compute_name`}}",
"virtual_network_name": "SFP-COMMON-VNet",
"virtual_network_subnet_name": "SFP-COMMON-subnet",
"virtual_network_resource_group_name": "SFP-COMMON-resourceGroup",        
"private_virtual_network_with_public_ip": true,
"polling_duration_timeout": "0h30m0s",

"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_pty": "true",

"location": "{{user `location`}}",
"vm_size": "{{user `vm_size`}}",
"managed_image_name": "{{user `managed_image_name`}}",
"managed_image_resource_group_name": "{{user `sig_gallery_resource_group`}}",

"shared_image_gallery_timeout": "2h5m2s",
"azure_tags": {
  "packer": "true"
}

}

],

nywilken commented 2 years ago

Hi @rahulnegirock thanks for reporting. I saw you opened a thread on HashiCorp discuss as well. So I am happy that you opened a but on Packer. I'm going to transfer this issue to the Azure plugin repository and slate it for review.

Once transferred could you provide a redacted build log by running PACKER_LOG=1 packer build <your-template>. So that we can see what steps are being executed.

That said, Is the password failing to SSH to the machine at build time "Packer is outputting SSH errors"? Or are you saying that once the image is built you are unable to SSH with the same credentials?

rahulnegirock commented 2 years ago

Hi @rahulnegirock thanks for reporting. I saw you opened a thread on HashiCorp discuss as well. So I am happy that you opened a but on Packer. I'm going to transfer this issue to the Azure plugin repository and slate it for review.

Once transferred could you provide a redacted build log by running PACKER_LOG=1 packer build <your-template>. So that we can see what steps are being executed.

That said, Is the password failing to SSH to the machine at build time "Packer is outputting SSH errors"? Or are you saying that once the image is built you are unable to SSH with the same credentials?

Hi, Once image is built then I'm unable to SSH with the same credentials. Using Packer version: 1.7.10 [go1.17.6 linux amd64]

edergillian commented 1 year ago

Hi @rahulnegirock thanks for reporting. I saw you opened a thread on HashiCorp discuss as well. So I am happy that you opened a but on Packer. I'm going to transfer this issue to the Azure plugin repository and slate it for review. Once transferred could you provide a redacted build log by running PACKER_LOG=1 packer build <your-template>. So that we can see what steps are being executed. That said, Is the password failing to SSH to the machine at build time "Packer is outputting SSH errors"? Or are you saying that once the image is built you are unable to SSH with the same credentials?

Hi, Once image is built then I'm unable to SSH with the same credentials. Using Packer version: 1.7.10 [go1.17.6 linux amd64]

I'm facing the same issue after creating a virtual machine from a template created using vsphere-iso. The credentials work for the build process, but they fail when I try to log into the machine after it's provisioned in vCenter

Lancelot0105 commented 6 months ago

I'm facing a similar issue too, It'd be great if someone can follow up on this !