New Vagrant Packaged Windows Server 2016 returning Authentication failure. Retrying

vagrantvirtualboxwindows-server-2016

I'm creating a base image using Windows Server 2016. The image is fully patched and has all the normal configuration applied, but when I test it, it fails to connect as the vagrant user, with a message that, from Google searches, implies it is trying to use SSH, although WinRM is listed in the dialog.

I've put my build documentation in github for reference.

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'WindowsDocker'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: temp_default_1489982222856_48671
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 5985 (guest) => 55985 (host) (adapter 1)
    default: 5986 (guest) => 55986 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: WinRM address: 127.0.0.1:55985
    default: WinRM username: vagrant
    default: WinRM execution_time_limit: PT2H
    default: WinRM transport: negotiate
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...

Note: Once the box is up, I can manually connect to is using WinRM?

$securePassword = ConvertTo-SecureString 'vagrant' -asplaintext -force
$cred = New-Object System.Management.Automation.PSCredential ('vagrant', $securePassword)
enter-pssession 127.0.0.1 -port 55985 -Auth CredSSP -credential $cred
[127.0.0.1]: PS C:\Users\vagrant\Documents> exit

Platform details

  • Host is Windows 10
  • Vagrant version is 1.9.2
  • Oracle VirtualBox 5.1.18
  • Guest is Windows Server 2016 Standard Evaluation

Note: In Vagrant 1.9.1, the guest gets destroyed instead…

    default: WinRM transport: negotiate
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-1.8.1/lib/winrm/http/response_handler.rb:57:in `raise_if_auth_error': WinRM::WinRMAuthorizationError (WinRM::WinRMAuthorizationError)

Best Answer

So it turns out I was not diabling User Account Controls (UAC), I've added the following to my worksheet.

reg add HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /d 0 /t REG_DWORD /f /reg:64
Related Topic