Chef-run winrm WinRM::WinRMAuthorizationError

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

Workstation on Linux:

$ chef-run 'winrm://' 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.
└── [✖] [] WinRM::WinRMAuthorizationError


An unexpected error has occurred:


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


Windows 2016 winrm config

PS C:\Users\Administrator> winrm get winrm/config
    MaxEnvelopeSizekb = 500
    MaxTimeoutms = 60000
    MaxBatchItems = 32000
    MaxProviderRequests = 4294967295
        NetworkDelayms = 5000
        URLPrefix = wsman
        AllowUnencrypted = false
            Basic = true
            Digest = true
            Kerberos = true
            Negotiate = true
            Certificate = true
            CredSSP = false
            HTTP = 5985
            HTTPS = 5986
        RootSDDL = <masked string>
        MaxConcurrentOperations = 4294967295
        MaxConcurrentOperationsPerUser = 1500
        EnumerationTimeoutms = 240000
        MaxConnections = 300
        MaxPacketRetrievalTimeSeconds = 120
        AllowUnencrypted = true
            Basic = true
            Kerberos = true
            Negotiate = true
            Certificate = false
            CredSSP = false
            CbtHardeningLevel = Relaxed
            HTTP = 5985
            HTTPS = 5986
        IPv4Filter = *
        IPv6Filter = *
        EnableCompatibilityHttpListener = false
        EnableCompatibilityHttpsListener = false
        AllowRemoteAccess = true
        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://'

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

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

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

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.

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

chef-run winrm:// --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...