-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
(Packer Azure) Error 401 - invalid content type throwing after PS domain join script was executed #6291
Comments
Hi @SwampDragons, just wondering if there is any update for this bug in Packer? Thanks. |
No, sorry. I haven't had a chance to inspect. |
I also have this issue on Packer 1.4.0 with AzureRM. I am executing a domain join via Chef which works fine on my test kitchen but fails on Packer (when running the same recipe). The domain join executes, I run a packer restart and it looks like it uploads the next provisioner initially (see below where it has Packer's verbose logs post reboot:
|
Looking at the README for our golang winrm library, domain users aren't supported, which may explain why we fail to connect immediately after performing a domain join. One possible workaround would be to perform the domain join as the very last step in the last provisioner in your Packer build; that would prevent Packer from needing to reconnect post-join. |
Hi @SwampDragons, Any suggestions and recommendations are highly appreciated? Thanks :) |
Sorry... I'm not a Windows expert, so I'm not a great person to ask. These kinds of "does anyone have any bright ideas?" questions are generally much better answered by our mailing list, since a lot more people will see them there. The only thing I can think of is pretty hacky -- you could try cloning the git repo to the machine running Packer and use the file provisioner to upload the repo to your windows VM. |
This issue has been automatically migrated to hashicorp/packer-plugin-azure#22 because it looks like an issue with that plugin. If you believe this is not an issue with the plugin, please reply to hashicorp/packer-plugin-azure#22. |
Packer failed to continue running the template with http response error: 401 - invalid content type after the PowerShell domain join command was executed.
As I need to add the temporary VM which is generated by Packer during the build into the domain, I have added a Domain join PowerShell script into the template which looks like this (I have tested this script several times in a fresh VM and it got no errors with it - it will add the VM to the domain):
$domain = "xxxxx" $password = "xxxxx" | ConvertTo-SecureString -asPlainText -Force
$username = "$domain\aaa.bbb"
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
Add-Computer -DomainName $domain -Credential $credential
This is the Azure Packer template that I ran:
https://gist.github.com/ngeegoh/369b3dac2d8e4f5661a5e7d2754c7bd3
(The reason why I put 2 window-restart before running PS domain join script was just to make sure the windows-restart is working in Packer.)
Additionally, if I replace the "Domain join" with other normal PS scripts, they just work normally and Packer will generate the build artifact at the end. Not sure what happened with the Packer after the Domain join script was executed, nothing after could run and kept throwing error 401: Invalid content. I tried to debug it but still did not see anything and did not have enough information as well.
I have talked to several Packer contributors and even posted it in the mailing list but no one could really resolve this issue which I am not sure if it is the Packer bug or not as if it is good, Packer is supposed to run the Domain join script and then continue running the template without throwing errors right. Hope you guys could help or maybe just try to run the above template and PS script to see if you got the same error as mine! Thanks
I have attached the log for the packer build of the above template below.
Info:
Azure packer
Packer version from 1.2.3
Host platform: Windows10
Debug log output from PACKER_LOG=1 packer build template.json.
https://gist.github.com/ngeegoh/4fc8ceecd68335d872aead39c859db20
The text was updated successfully, but these errors were encountered: