hashicorp / hashicorp/packer-plugin-azure

Packer encounters "Error uploading ps script containing env vars" during the powershell provisioner step

Open
#61 5 comments 1 reaction 0 assignees View on GitHub
bug builder/azure provisioner/powershell
Dominant language
Go
Stars
63
Forks
103
PR merge metrics
No merged PRs in 30d

Description

_This issue was originally opened by @sagilson as hashicorp/packer#10357. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._


#### Overview of the Issue

An azure customer is attempting to use the Azure Image Builder service to create a Windows 2004 19h2-evd image that includes only windows update and windows restart. Azure Image Builder uses packer and the azure-arm builder to create images. During the powershell provisioning step, packer is unable to upload a powershell script that contains environment variables, causing packer to fail the image build.

#### Reproduction Steps

Attempt to create a Windows 2004 19h2-evd image with windows update and restart using either the Azure Image Builder service or packer version with commit hash 5ddd02d1c0e5d8b1b0e2171d2d40c7d7b5641e68 (packer_1.6.1_linux_amd64).

### Packer version

From `packer version`
packer_1.6.1_linux_amd64

Also using
v0.9.0 packer-provisioner-windows-update-linux.tgz

### Simplified Packer Buildfile

Cannot post for security reasons as I do not own the template in question, but the customer has told me the template only contains base image Windows 2004 w/ sku 19h2-evd and the only customizers are windows update and restart.

### Operating system and Environment details
Debian-like linux distro with more security patches and azure specific changes.

### Log Fragments and crash.log files

[ec332261-ebd9-43ae-80d4-11cd378aad0b] PACKER ERR 2020/12/04 08:17:16 packer-provisioner-powershell plugin: Uploading env vars to c:/Windows/Temp/packer-ps-env-vars-5fc9e087-7e72-f676-6b03-871326abc66c.ps1
[ec332261-ebd9-43ae-80d4-11cd378aad0b] PACKER ERR 2020/12/04 08:17:16 packer-provisioner-powershell plugin: [INFO] 74 bytes written for 'uploadData'
[ec332261-ebd9-43ae-80d4-11cd378aad0b] PACKER ERR 2020/12/04 08:17:16 [INFO] 74 bytes written for 'uploadData'
[ec332261-ebd9-43ae-80d4-11cd378aad0b] PACKER ERR 2020/12/04 08:17:16 packer-builder-azure-arm plugin: Uploading file to 'c:/Windows/Temp/packer-ps-env-vars-5fc9e087-7e72-f676-6b03-871326abc66c.ps1'
[ec332261-ebd9-43ae-80d4-11cd378aad0b] PACKER ERR 2020/12/04 08:28:49 packer-provisioner-powershell plugin: Retryable error: Error uploading ps script containing env vars: Error uploading file to $env:TEMP\winrmcp-2735b5fd-6a49-4753-71d9-0be9e8c8d7fd.tmp: Couldn't create shell: unknown error Post https:///wsman: EOF

Contributor guide

Open the contributing guide

Research direction

Start with the powershell provisioner step and the azure-arm builder upload shown in the log fragments, then reproduce the Windows image build using the stated Packer version and environment. No repository files or tests are named; done means the environment-variable script uploads successfully without the WinRM EOF error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.