Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading large file and directories using SSH communicator to create Azure Windows Image #12284

Closed
Zaheerkhan999 opened this issue Feb 21, 2023 · 2 comments

Comments

@Zaheerkhan999
Copy link

Hi,

I am creating an image with file folders to be uploaded into the Azure windows image.

What I have done so far. I have created a custom windows image with SSH server installed and running the below packer script to provision a new image from that custom image. Packer is able to create all the required resources at runtime but not able to upload any files to it and terminates with the error "Context deadline exceeded".
The same is achievable from winrm but failing with SSH.
Since the files and directories are huge in size so it is taking a lot of time to transfer using winrm that's why I chose SSH communicator to quicky upload the files but its failing.

########################################################################
source "azure-arm" "autogenerated_1" {
azure_tags = {
dept = "Engineering"
task = "Image deployment"
}
build_resource_group_name = "TEST-RG"
client_id = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
client_secret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
communicator = "ssh"
custom_managed_image_name = "SSH-WindowsImage"
custom_managed_image_resource_group_name = "TEST-RG"
managed_image_name = "Windows-image"
managed_image_resource_group_name = "TEST-RG"
os_type = "Windows"
subscription_id = "XXXXXXXXXXXXXXXXXXXXX"
tenant_id = "XXXXXXXXXXXXXXXXXXXXX"
vm_size = "Standard_D2_v2"
ssh_username = "userzktest1"
ssh_password = "PassPktest@123!"
ssh_port = 22
pause_before_connecting = "5m"
ssh_file_transfer_method = "sftp"

}

build {
sources = ["source.azure-arm.autogenerated_1"]

provisioner "file" {
source = "files/bin.zip"
destination = "C:/code/bin.zip"

}

provisioner "powershell" {
inline = ["while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }", "while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }", "& $env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /quiet /quit", "while($true) { $imageState = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10 } else { break } }"]
}

}
###############################################################################

Any help will be highly appreciated.

Thanks in advance.

@github-actions
Copy link

github-actions bot commented Apr 7, 2023

This issue has been migrated to hashicorp/packer-plugin-azure#288 due to the Packer Plugin split.

Please follow the new issue for updates.

@github-actions
Copy link

github-actions bot commented May 8, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants