Created a Image using that VM (Ex: Name - Centos-Custom-Image-v1)
I’m able to launch a new VM without any errors with that image from Azure Portal.
Now, I tried to create a Golden image (Ex: New-Centos-Golden-Image-v1) by installing necessary packages, dependencies, perform CIS benchmark standard practices in it by using “Packer” on “Centos-Custom-Image-v1”.
I created it without any errors by packer. While launching a new VM from that new golden image (built using packer), it is taking longer time for deploying (more than 30 min) before session timeout . And when I refresh the page after session timeout, it is showing the below attached error message though the VM created successfully.
And I tried to take ssh connection to the VM created using our Packer thereby supplying the credentials provided while VM creation.
It is not at all accepting it and I even tried to break the root password, it didn’t work.
So, I suspect that the provisioning failure causes the VMs (created using the golden image) unusable.
Can someone please go through my Packer build script and let me know if any corrections to be made from my side?
I tried with including “ssh communicator” in the packer and included ansible roles to update “sshd_config” file with necessary parameters during provision.
Even still, the deployment is getting failed after progressing for around 30 to 35 mins. VM is created and unable to connect to it via ssh.
I’m here attaching the packer logs and updated packer build script also for your reference. Kindly review and share your suggestion.
Because, as per the steps (azure-cli) mentioned at microsoft site, we need to follow deprovision, deallocate, generalize and then proceed with image creation.
I tried with executing “waagent deprovision” inside the VM by including it in ansible role and thereby added the other steps like deallocate, generalize in packer main script (.json) file.
But still it ended up with az authentication errors. Could someone please help on this?