I'm trying to create Windows images for usage on Azure using Packer. As part of this process, I need to put some files, which are located on an existing VM in Azure, in the image. My idea was to add the VM to the domain, so that I can copy the files directly. However, so far I haven't been able to add the image to the domain.
I've tried running a powershell script, but this gives me the following error message:
Error uploading ps script containing env vars: Error uploading file to $env:TEMP
Next, I've tried running the "Add-Computer" command directly from a powershell-provisioner (both regular and with an elevated user), but neither option was successfull. With the regular shell, it seems as if Packer is just stuck. Nothing happens after the message Provisioning with Powershell
. The elevated shell gives me an error message:
(12,8):UserId:
==> azure-arm.xxxxx: At C:\Windows\Temp\packer-elevated-shell-617ab2e4-e084-8ef8-f9f6-0d66a82a0129.ps1:60 char:1
Does anyone know how to add an image to the domain? Or is there another way that I can copy the files from the existing VM to the image? Or perhaps it is best to copy the files during deployment using Terraform?