# Test kitchen is unable to winrm into windows vm

**URL:** <https://discourse.chef.io/t/test-kitchen-is-unable-to-winrm-into-windows-vm/8799>\
**Category:** Chef Infra (archive)\
**Created:** [June 27, 2016, 11:05pm UTC](https://discourse.chef.io/t/test-kitchen-is-unable-to-winrm-into-windows-vm/8799 "2016-06-27T23:05:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![spuder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/spuder/32/1382_2.png) [@spuder](https://discourse.chef.io/u/spuder)\
**Post date:** [June 27, 2016, 11:05pm UTC](https://discourse.chef.io/t/test-kitchen-is-unable-to-winrm-into-windows-vm/8799/1 "2016-06-27T23:05:04Z")

</div>

Trying to make my own windows 2012 R2 vagrant VM for test kitchen.

I’ve created a box based on these instructions

> **[Creating windows base images using Packer and Boxstarter](https://matt-wrock.squarespace.com/blog/creating-windows-base-images-for-virtualbox-and-hyper-v-using-packer-boxstarter-and-vagrant?rq=packer)**
>
> I've written a couple posts on how to create vagrant boxes for windows and how to try and get the base image as small as possible. These posts explain the multiple steps of preparing the base box and then the process of converting that box to the...

I’ve ensured:

- windows firewall turned off
- winrm is configured to [allow non https](https://github.com/mwrock/packer-templates/blob/master/scripts/package.ps1#L42-L44)
- username & password = vagrant
- virtualbox port forwarding is configured correctly

I am able to winrm into the virtualbox from my mac.

```
knife wsman test 127.0.0.1 -m -p 55985
Connected successfully to 127.0.0.1 at http://127.0.0.1:55985/wsman.

```

Yet when I try and run `kitchen setup` It fails to authenticate.

```
sowens-MBP:nd-web sowen$ ki setup -l debug
-----> Starting Kitchen (v1.10.0)
D [Vagrant command] BEGIN (vagrant --version)
D [Vagrant command] END (0m0.30s)
D [Vagrant command] BEGIN (vagrant plugin list)
D [Vagrant command] END (0m1.14s)
D Berksfile found at /Users/sowen/Devops/cookbooks/nd-web/Berksfile, loading Berkshelf
D Berkshelf 4.3.5 library loaded
D winrm requested, loading winrm gem (["~> 1.6"])
D winrm is loaded.
D winrm-fs requested, loading winrm-fs gem (["~> 0.4.1"])
D winrm-fs is loaded.
-----> Creating <default-windows-2012>...
D <default-windows-2012> is synchronizing on Kitchen::Driver::Vagrant#create
D <default-windows-2012> is messaging Kitchen::Driver::Vagrant#create
D Creating Vagrantfile for <default-windows-2012> (/Users/sowen/Devops/cookbooks/nd-web/.kitchen/kitchen-vagrant/kitchen-nd-web-default-windows-2012/Vagrantfile)
D ------------
D Vagrant.configure("2") do |c|
D c.berkshelf.enabled = false if Vagrant.has_plugin?("vagrant-berkshelf")
D c.vm.box = "spencer/win2012-vagrant"
D c.vm.communicator = "winrm"
D c.vm.guest = ":windows"
D c.vm.synced_folder ".", "/vagrant", disabled: true
D c.vm.provider :virtualbox do |p|
D p.customize ["modifyvm", :id, "--memory", "4096"]
D end
D end
D ------------
D [Vagrant command] BEGIN (vagrant up --no-provision --provider virtualbox)
       Bringing machine 'default' up with 'virtualbox' provider...
       ==> default: VirtualBox VM is already running.
D [Vagrant command] END (0m2.43s)
D [Vagrant command] BEGIN (vagrant winrm-config)
D [Vagrant command] END (0m2.42s)
       [WinRM] connection failed. retrying in 3 seconds: #<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>
       [WinRM] connection failed. retrying in 3 seconds: #<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>
       [WinRM] connection failed. retrying in 3 seconds: #<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>
       [WinRM] connection failed. retrying in 3 seconds: #<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>
       [WinRM] connection failed. retrying in 3 seconds: #<WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError>

```

.kitchen.yml

```
---
driver:
  name: vagrant
  customize:
    memory: 4096

provisioner:
  name: chef_zero

platforms:
  - name: windows-2012
    transport:
      name: winrm
      max_threads: 1
      username: vagrant
      password: vagrant
    driver:
      port: 55985
      guest: :windows
      box: spencer/win2012-vagrant
    driver_config:
      guest: windows
      communicator: winrm
      vm_hostname: false
    run_list:
    attributes:
      test_kitchen: true

```

I am able to use other windows vagrant boxes like this one

[https://wrock.blob.core.windows.net/vhds/vbox2012r2.box](https://wrock.blob.core.windows.net/vhds/vbox2012r2.box)

```
---
driver:
  name: vagrant
  customize:
    memory: 4096

provisioner:
  name: chef_zero
  # require_chef_omnibus: 12.9.41

platforms:
  - name: windows-2012
    transport:
      name: winrm
      max_threads: 1
      username: vagrant
      password: vagrant
    driver:
      port: 55985
      guest: :windows
    driver_config:
      box_url: https://wrock.blob.core.windows.net/vhds/vbox2012r2.box
      guest: windows
      communicator: winrm
      vm_hostname: false
    run_list:
    attributes:
      test_kitchen: true

```

What else could I be missing that causes test kitchen to fail to winrm into my box, but works with other vagrant boxes?

---

<div class="post-metadata">

**Author:** ![spuder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/spuder/32/1382_2.png) [@spuder](https://discourse.chef.io/u/spuder)\
**Post date:** [June 28, 2016, 7:35pm UTC](https://discourse.chef.io/t/test-kitchen-is-unable-to-winrm-into-windows-vm/8799/2 "2016-06-28T19:35:24Z")

</div>

Solution is to move the ‘username’ and ‘password’ values to the `driver_config` section

```
---
platforms:
  - name: windows-2012
    driver_config:
      box: spencer/win2012-vagrant
      username: administrator
      password: vagrant
      communicator: winrm
    run_list:

```

Further debugging

```
knife bootstrap windows winrm 127.0.0.1 \
--winrm-user administrator \
--winrm-password 'vagrant' \
--winrm-port 55985 \
--node-name vagrant-test
```
