Hi,
I’m using Builder and Provisioner to create Windows Image with a software install on it on Azure Cloud however build is getting failed while copying the file to VM being created. Error Message is: Build ‘azure-arm’ errored: Error uploading file to $env:TEMP\winrmcp-c3168c08-eeb0-4d5d-6130-6e0d16d68147.tmp: Couldn’t create shell: http response error: 401 - invalid content type. Any help would appreciate.
"builders": [{
"type": "azure-arm",
"subscription_id": "<sub-id>",
"managed_image_resource_group_name": "test-mansing",
"managed_image_name": "New-Image-Create-By-Packer-Windows-withsoftware",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2016-Datacenter",
"azure_tags": {
"dept": "engineering"
},
"location": "West US",
"vm_size": "Standard_A2",
"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_timeout": "25m",
"winrm_username": "packer"
}],
"provisioners": [{
"type": "powershell",
"inline": [
" # NOTE: the following *3* lines are only needed if the you have installed the Guest Agent.",
" while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
"if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}",
"& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit /mode:vm",
"while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; Write-Output $imageState.ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Start-Sleep -s 10 } else { break } }"
]
},
{ "type": "file",
"source": "StorageExplorer.exe",
"destination": "C:/Temp/"
},
{ "type": "powershell",
"inline": ["C:/Temp/StorageExplorer.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART"]
}]}```