[RESOLVED] Chef workstation failed to connect Chef Client

Hi

I have two Windows Server 2012 R2 VM machines. One is for Chef Workstation and another is for Chef Client node.
I have no chef-server, so I am directly deploying recipes from chef-workstation VM to Chef-Client VM.
Both chef-workstation and chef-client on same network and both are reachable to each other using remote desktop connection and ping command.

target_host is my chef-client VM machine.

I followed below steps to deploy recipes from chef-workstation to chef-client:

  1. As per this link: https://www.chef.sh/docs/chef-workstation/getting-started/
    Installed chef-workstation and chef development tool kit on chef-workstation VM.
  2. I am using command chef-run winrm://user:password@target_host package ntp from workstation machine.
    But it is failing:
C:\chef-repo>chef-run winrm://username:password@target_host package ntp
[✔] Generated local policyfile
[✖] [target_host] WinRM::WinRMAuthorizationError
CHEFINT001

An unexpected error has occurred:

WinRM::WinRMAuthorizationError

If you are not able to resolve this issue, please contact Chef support
at beta@chef.io and include the log file and stack trace from the
locations below:

Error in stack-trace log:

2018-07-19 19:34:43 -0700: Error encountered while running the following:
  winrm://username:password@target_host package ntp
Backtrace:
WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/http/response_handler.rb:58:in `raise_if_auth_error'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/http/response_handler.rb:51:in `raise_if_error'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/http/response_handler.rb:36:in `parse_to_xml'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/http/transport.rb:186:in `send_request'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/http/transport.rb:181:in `send_request'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/power_shell.rb:152:in `max_envelope_size_kb'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/power_shell.rb:80:in `max_fragment_blob_size'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/power_shell.rb:198:in `fragmenter'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/power_shell.rb:162:in `block in open_shell_payload'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/power_shell.rb:161:in `map'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/power_shell.rb:161:in `open_shell_payload'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/power_shell.rb:122:in `open_shell'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/base.rb:168:in `block in open'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/retryable.rb:37:in `retryable'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/base.rb:166:in `open'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/base.rb:129:in `with_command_shell'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/winrm-2.2.3/lib/winrm/shells/base.rb:81:in `run'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/train-1.4.4/lib/train/transports/winrm_connection.rb:103:in `run_command_via_connection'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/train-1.4.4/lib/train/transports/winrm_connection.rb:83:in `wait_until_ready'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.0/lib/chef_apply/target_host.rb:79:in `connect!'
              C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.0/lib/chef_apply/cli.rb:407:in `do_connect'

I tried to troubleshoot above error by connecting to WinRM directly from chef-workstation. I executed below command from chef-workstation, it is running fine:
winrs -r:http://target_host:5985 -u:username -p:password echo "testing"

But when I executed below using secure http command, it is getting failed:
winrs -r:https://target_host:5986 -u:username -p:password echo "testing"

Winrs error:The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".

To configure the connection, then I executed below commands, but still there is no progress:
winrm quickconfig
winrm s winrm/config/client '@{TrustedHosts="target_host"}'

Any suggestion is greatly appreciated.

Thank you,
Deepak Singla

Resolved