# Chef-run winrm WinRM::WinRMAuthorizationError

**URL:** <https://discourse.chef.io/t/chef-run-winrm-winrm-winrmauthorizationerror/16239>\
**Category:** Chef Infra (archive)\
**Created:** [November 15, 2019, 4:55am UTC](https://discourse.chef.io/t/chef-run-winrm-winrm-winrmauthorizationerror/16239 "2019-11-15T04:55:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yang-tech](https://avatars.discourse-cdn.com/v4/letter/y/13edae/32.png) [@yang-tech](https://discourse.chef.io/u/yang-tech)\
**Post date:** [November 15, 2019, 4:55am UTC](https://discourse.chef.io/t/chef-run-winrm-winrm-winrmauthorizationerror/16239/1 "2019-11-15T04:55:57Z")

</div>

Hi there,  
Can anybody help me what caused this error?

Workstation on Linux:

```
$ chef-run 'winrm://Administrator:password@xx.xx.x.xxx' sv_os_config::win_os_hardening --no-ssl-verify
[✔] Packaging cookbook... done!
[✔] Generating local policyfile... exporting... done!
[✖] Applying sv_os_config::win_os_hardening from /home/username/chef/chef-repo/cookbooks/sv_os_config to target.
└── [✖] [xx.xx.x.xxx] WinRM::WinRMAuthorizationError

CHEFINT001

An unexpected error has occurred:

  WinRM::WinRMAuthorizationError

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

  /home/username/.chef-workstation/logs/default.log
  /home/username/.chef-workstation/logs/stack-trace.log

```

Windows 2016 winrm config

```
PS C:\Users\Administrator> winrm get winrm/config
Config
    MaxEnvelopeSizekb = 500
    MaxTimeoutms = 60000
    MaxBatchItems = 32000
    MaxProviderRequests = 4294967295
    Client
        NetworkDelayms = 5000
        URLPrefix = wsman
        AllowUnencrypted = false
        Auth
            Basic = true
            Digest = true
            Kerberos = true
            Negotiate = true
            Certificate = true
            CredSSP = false
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        TrustedHosts
    Service
        RootSDDL = <masked string>
        MaxConcurrentOperations = 4294967295
        MaxConcurrentOperationsPerUser = 1500
        EnumerationTimeoutms = 240000
        MaxConnections = 300
        MaxPacketRetrievalTimeSeconds = 120
        AllowUnencrypted = true
        Auth
            Basic = true
            Kerberos = true
            Negotiate = true
            Certificate = false
            CredSSP = false
            CbtHardeningLevel = Relaxed
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        IPv4Filter = *
        IPv6Filter = *
        EnableCompatibilityHttpListener = false
        EnableCompatibilityHttpsListener = false
        CertificateThumbprint
        AllowRemoteAccess = true
    Winrs
        AllowRemoteShellAccess = true
        IdleTimeout = 7200000
        MaxConcurrentUsers = 2147483647
        MaxShellRunTime = 2147483647
        MaxProcessesPerShell = 2147483647
        MaxMemoryPerShellMB = 2147483647
        MaxShellsPerUser = 2147483647

```

The following two commands ran successfully, but not the chef-run command.

```
$ inspec exec test/integration/profile/controls/win_os_hardening_test.rb -t 'winrm://Administrator:password@xx.xx.x.xxx'

$ knife winrm 'name:nodename' --winrm-user Administrator -a ipaddress 'chef-client -l info -L C:\chef\client.log' --winrm-password password
```

---

<div class="post-metadata">

**Author:** ![Tensibai](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tensibai/32/29_2.png) [@Tensibai](https://discourse.chef.io/u/Tensibai)\
**Post date:** [November 15, 2019, 1:40pm UTC](https://discourse.chef.io/t/chef-run-winrm-winrm-winrmauthorizationerror/16239/2 "2019-11-15T13:40:11Z")

</div>

Are you really sure of the password you typed ? AuthorizationError has few chances to be something else than that, with redacted logs we can't be sure nor spot a typo so I'm asking just in case.

Could be a train vs knife internal winrm difference too, but I would expect something else as error message than an authorization thing

---

<div class="post-metadata">

**Author:** ![yang-tech](https://avatars.discourse-cdn.com/v4/letter/y/13edae/32.png) [@yang-tech](https://discourse.chef.io/u/yang-tech)\
**Post date:** [November 18, 2019, 4:38am UTC](https://discourse.chef.io/t/chef-run-winrm-winrm-winrmauthorizationerror/16239/3 "2019-11-18T04:38:24Z")

</div>

Hi Tensibai, I am sure the password I typed was correct, any chances that the error was caused by the winrm configruation?

---

<div class="post-metadata">

**Author:** ![sasydharan](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@sasydharan](https://discourse.chef.io/u/sasydharan)\
**Post date:** [November 19, 2019, 4:21pm UTC](https://discourse.chef.io/t/chef-run-winrm-winrm-winrmauthorizationerror/16239/4 "2019-11-19T16:21:37Z")

</div>

Other issue might be a chance of firewall enabled on the instance if the password and username is right. Look for correct firewall rules or disable it for temporary fix.

---

<div class="post-metadata">

**Author:** ![yang-tech](https://avatars.discourse-cdn.com/v4/letter/y/13edae/32.png) [@yang-tech](https://discourse.chef.io/u/yang-tech)\
**Post date:** [November 20, 2019, 12:15am UTC](https://discourse.chef.io/t/chef-run-winrm-winrm-winrmauthorizationerror/16239/5 "2019-11-20T00:15:29Z")

</div>

I managed to solve this by changing the format of the options to the below:

`chef-run winrm://xx.xx.x.xxx --user Administrator --password password sv_os_config::win_os_hardening`

Although the Chef docs says it should work even if I use the origin one...
