3

I followed the instructions on this blog post to get a Vagrant box with Windows Server 2012 R2 eval. Then I tried to install Active Directory Domain Controller and an Active Directory Forest (with first domain) using Vagrant provisioning feature. PowerShell scripts are from the same blog, see here. However, after the installation of the AD forest - which needs a reboot -, Vagrant is losing WinRM connection with the following error and doesn't continue with provisioning:

Error occurred: An authorization error occurred while connecting to WinRM.

User: vagrant
Endpoint: http://127.0.0.1:5985/wsman
Message: WinRM::WinRMAuthorizationError

It seems that the AD forest installation breaks network/authentication until Windows is rebooted. The actual installation seems to be successful. But the problem is that the provisioning was not done completely (I have a script that would add a new AD user after forest is installed).

Any ideas how to fix that?

Maybe as a work-around: Is it possible to setup a script that runs AD forest installation on Windows startup such that no reboot is required?

1 Answer 1

0

I had the same probelm and just found the solution. Add these to your machine config.

cfg.winrm.transport = :plaintext
cfg.winrm.basic_auth_only = true

and then reboot the machine if you need to do more provisioning after that step.

In that case use the vagrant-reload plugin to do reboot during provisioning. Like this

adfs.vm.provision "shell", path: "create-domain.ps1"
adfs.vm.provision "reload"
adfs.vm.provision "shell", path: "more-provisioning.ps1"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .