Steps to reproduce
- Run
Invoke-WebRequest -Uri https://internalwebsite.local (actual URL hidden for security)
Expected behavior
Web request succeeds, similar to how the web browser (eg. Google Chrome, Firefox, Safari) successfully opens the secured page.
Actual behavior
An exception is thrown:
Invoke-WebRequest : An error occurred while sending the request.
At line:1 char:1
+ Invoke-WebRequest https://internalwebsite.local
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Method: GET, Re...rShell/6.0.0
}:HttpRequestMessage) [Invoke-WebRequest], HttpRequestException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
When I dig into the exception, I find:
PS /> $error[0].Exception.InnerException
Peer certificate cannot be authenticated with given CA certificates
Environment data
Name Value
---- -----
PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.14
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Cheers,
Trevor Sullivan
Docker Captain
Microsoft MVP: Cloud & Data Center Management
https://trevorsullivan.net
https://twitter.com/pcgeek86
Steps to reproduce
Invoke-WebRequest -Uri https://internalwebsite.local(actual URL hidden for security)Expected behavior
Web request succeeds, similar to how the web browser (eg. Google Chrome, Firefox, Safari) successfully opens the secured page.
Actual behavior
An exception is thrown:
When I dig into the exception, I find:
Environment data
Cheers,
Trevor Sullivan
Docker Captain
Microsoft MVP: Cloud & Data Center Management
https://trevorsullivan.net
https://twitter.com/pcgeek86