I am getting an error when trying to enable Tracing in one of our servers.
Commands used:
Add-PSSnapin Microsoft.Crm.PowerShell
Get-CrmSetting TraceSettings
Error:
Get-CrmSetting : The underlying connection was closed: Could not establish trust relationship for the
SSL/TLS secure channel.
At line:1 char:1
+ Get-CrmSetting TraceSettings
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Crm.P...rmSettingCmdlet:GetCrmSettingCmdlet) [Get-
CrmSetting], WebException
+ FullyQualifiedErrorId : CRM Deployment Cmdlet Error,Microsoft.Crm.PowerShell.GetCrmSettingCmdlet
This is a multi-server environment where Web and Application are separate.
Best Answer
The error indicates that the certificate used on the end point you are trying to connect to is an un-trusted certificate.
I recommend ensuring that a valid and trusted certificate is used on the endpoint.
However if this is not possible you can set PowerShell to allow un-trusted certificates once per session with this function.
However be warned that running this function will disable ALL certificate checks that PowerShell would normally preform and the only way to reset this is to close and re-open PowerShell.
Special thanks to Matt Graeber for authoring the code.