microsoft / SQLServerPSModule

This repo is the home of SQL Server PowerShell Module development.
MIT License
45 stars 1 forks source link

Read-SQLXEvent can't connect to servers without certs #56

Closed tcartwright closed 11 months ago

tcartwright commented 11 months ago

Using latest version of SQLServer. When trying to use the Read-SQLXEvent with a server that does not have a certificate chain this error is received:

Read-SQLXEvent : A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) At line:1 char:1

  • Read-SQLXEvent -ConnectionString "Server=................;D ...
  • 
    + CategoryInfo          : NotSpecified: (:) [Read-SqlXEvent], SqlException
    + FullyQualifiedErrorId : Microsoft.Data.SqlClient.SqlException,Microsoft.SqlServer.Management.PowerShell.XEvent.SqlXEventCmdlet

Please add an -Encrypt parameter that can be used to bypass this similar to Invoke-SqlCmd

tcartwright commented 11 months ago

It finally dawned on me that this method takes in a connection string, so that Encrypt=False; can be added to the connection string to bypass this.