The packer user should still work.  Since we don't know the initial 
randomized packer password, to validate this I used the Azure portal to 
update the password for the packer user (still a local admin) and logged in 
with .\packer and the password I set in Azure.  I was able to log into the 
machine with both the domain account and the local packer admin account.  
My packer run is not valid after changing the password for that packer user 
though, since Packer itself doesn't know the new password.

On Monday, May 13, 2019 at 5:31:32 PM UTC-4, Megan Marsh wrote:
>
> I'm a novice at windows-specific sysadmining -- when you do a domain join, 
> does the original username/password you connected with still work or does 
> the domain join render it no longer valid?
>
> On Mon, May 13, 2019 at 12:49 PM Dina Muscanell <[email protected] 
> <javascript:>> wrote:
>
>> Hi All,
>>
>> *configuration:*
>> *Packer v 1.4.0*
>> *Azure Builder*
>>
>> I have worked with Packer a bit in the past but not specifically a domain 
>> joined packer run.  Has anyone been able to get a Packer run to work while 
>> joining a domain?  
>>
>> I have all of my logic written in Chef and in the Packer run, I just 
>> execute the Chef code. My test kitchen in Chef works fine and can keep 
>> going after I've joined the domain but Packer can't seem to continue.  
>>
>> Both Chef and Packer use winrm to communicate but there has to be *some* 
>> difference if Chef is able to make sense of the domain join but Packer 
>> cannot.  Unfortunately, I haven't been able to figure out that difference.
>>
>> After the domain join occurs, we have to run a windows_restart for the 
>> changes to take effect but the Packer run never recovers.  Even though the 
>> machine is up and running (I can log into as the domain account) Packer 
>> doesn't pick up that it is available.  Here is the debug log showing some 
>> output from the powershell script that runs to join the domain, the windows 
>> restart is initiated properly but never recovers and throws 401 invalid 
>> content until the windows-restart times out.
>>
>>
>> 019/05/13 10:36:05 ui:     azure-arm: VERBOSE: Performing the operation 
>> "Join 
>> in domain 'mydomain.com'" on target
>> 2019/05/13 10:36:05 ui:     azure-arm:  "pkrvm4hxw4n4f89".
>> 2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] command 
>> 'powershell 
>> -executionpolicy bypass -file 
>> "C:/Windows/Temp/packer-elevated-shell-5cd980cd-a187-c086-26f2-8d764c3484ff.ps1"'
>>  
>> exited with code: 0
>> 2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] RPC endpoint: 
>> Communicator ended with: 0
>> 2019/05/13 10:36:08 [INFO] 313 bytes written for 'stdout'
>> 2019/05/13 10:36:08 [INFO] 0 bytes written for 'stderr'
>> 2019/05/13 10:36:08 ui:     azure-arm: HasSucceeded ComputerName
>> 2019/05/13 10:36:08 [INFO] RPC client: Communicator ended with: 0
>> 2019/05/13 10:36:08 [INFO] RPC endpoint: Communicator ended with: 0
>> 2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] 313 bytes 
>> written for 'stdout'
>> 2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] 0 bytes 
>> written for 'stderr'
>> 2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 [INFO] RPC client: 
>> Communicator ended with: 0
>> 2019/05/13 10:36:08 ui:     azure-arm: ------------ ------------
>> 2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 Error in Ui.Message 
>> RPC call: connection is shut down
>> 2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 Error in Ui.Message 
>> RPC call: connection is shut down
>> 2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 Error in Ui.Message 
>> RPC call: connection is shut down
>> 2019/05/13 10:36:08 packer.exe: 2019/05/13 10:36:08 Error in Ui.Message 
>> RPC call: connection is shut down
>> 2019/05/13 10:36:08 [INFO] (telemetry) ending powershell
>> 2019/05/13 10:36:08 [INFO] (telemetry) Starting provisioner windows-
>> restart
>> 2019/05/13 10:36:08 ui: ==> azure-arm: Pausing 2m0s before the next 
>> provisioner...
>> 2019/05/13 10:38:08 ui: ==> azure-arm: Restarting Machine
>> 2019/05/13 10:38:09 [INFO] 0 bytes written for 'stderr'
>> 2019/05/13 10:38:09 [INFO] 0 bytes written for 'stdout'
>> 2019/05/13 10:38:09 packer.exe: 2019/05/13 10:38:09 [INFO] 0 bytes 
>> written for 'stderr'
>> 2019/05/13 10:38:09 packer.exe: 2019/05/13 10:38:09 [INFO] 0 bytes 
>> written for 'stdout'
>> 2019/05/13 10:38:09 packer.exe: 2019/05/13 10:38:09 Retryable error: 
>> http response error: 401 - invalid content type
>> 2019/05/13 10:38:12 [INFO] 0 bytes written for 'stderr'
>> 2019/05/13 10:38:12 [INFO] 0 bytes written for 'stdout'
>>
>> windows-restart logic:
>> {
>> "type": "windows-restart",
>> "restart_command": "shutdown -r -f -t 10 && net stop winrm",
>> "restart_check_command": "powershell -command \"& {Write-Output 
>> 'restarted.'}\"",
>> "restart_timeout": "15m",
>> "pause_before": "2m"
>> },
>>
>> My packer build has the following configured for winrm:
>> "communicator": "winrm",
>> "winrm_use_ssl": "true",
>> "winrm_insecure": "true",
>> "winrm_timeout": "5m",
>> "winrm_username": "packer"
>>
>> I've tried to increase the timeout and updating winrm settings such as 
>> (but no luck): 
>> winrm set winrm/config/service @{AllowUnencrypted="true"}
>>
>> Any ideas or help would be appreciated, thanks for taking the time to 
>> read this.
>>
>> -- 
>> This mailing list is governed under the HashiCorp Community Guidelines - 
>> https://www.hashicorp.com/community-guidelines.html. Behavior in 
>> violation of those guidelines may result in your removal from this mailing 
>> list.
>>  
>> GitHub Issues: https://github.com/mitchellh/packer/issues
>> IRC: #packer-tool on Freenode
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Packer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/4a7024b1-6f7f-469f-89aa-e2122189d1cb%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/packer-tool/4a7024b1-6f7f-469f-89aa-e2122189d1cb%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/4e5f4135-65fc-49c6-ac4b-983561b150bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to