we use Powershell Universal 5 on IIS. I try to use Invoke-PSUScript -Name 'Example.ps1'
But i get the error
Cannot retrieve the dynamic parameters for the cmdlet. Status(StatusCode=“Internal”, Detail=“Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception. AuthenticationException: The remote certificate was rejected by the provided RemoteCertificateValidationCallback.”, DebugException=“System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.”)
We use a a ssl certificate from our internal pki.
Do you have any ideas how to fix this?
You can either add -TrustCertificate to the end of your Invoke-PSUScript command or, if you upgrade to 5.0.6, you can supposedly add the TrustCertificate parameter to your customized appsettings.json file by adding:
{
"Api": {
"TrustCertificate": true
}
}
But I’m not able to get this ability working in my own testing of 5.0.6.
Yes and No.
This is a new box.
I have a self-signed certificate, but am still waiting for the official one.
So the self-signed is not valid, and like you stated, the workaround don’t seem to work.
That’s why I use plain http for just the internal API calls.
The system is firewalled off, access for users only via https.
EDIT:
I now have this and it is working, https://zzz.yyy.xxx.net is actually not the real URL that users would use, but a FQDN that resolves locally as well and I have a machine certificate for. (not a certificate for SSL - but it seems to work)
I’m not sure. -TrustCertificate works fine for me on an Invoke-PSUScript command in 5.0.6. I put that parameter at the end, though. Maybe it’s positional, for some reason. Try moving it to the end.
I’m getting some odd behavior on this too in 5.0.7 - when trying to run Get-PSUEventHubConnection with TrustCertificate set to false in the app settings and the -TrustCertificate flag passed in manually, I get an error that the parameter doesn’t exist. However, when setting it to true in app settings AND passing the flag, I’m getting the behavior I expect. Setting it to true by itself returns the SSL error.
The environment variable seems to still be the safest way to get this to come together on IIS.