Set "Trust Certificate" for SQL Datasource

Resolved Implemented

Set "Trust Certificate" for SQL Datasource

avatar

Hi!

I am using the powershell module in a ubuntu docker container. The SQL linux driver force me to use encryption, so I installed a self signed certificate.

I am able to connect to the SQL server:
sqlcmd -S <server>\<instance> -U <user> -P <passwort> -C
The -C means "Trust Server Certificate"

In the RDM GUI I have to set the advanced setting "Trust certificate" to true to connect to the server.
How can I do this in the powershell module? ATM I get [Error] The operation was canceled when I set the datasource.

CU,
Timo

All Comments (4)

avatar

Hello Timo,

When using New-RDMDataSource -SQLServer, the option to trust the certificate is not available. I will create an internal ticket to add the option.

For now, you would need to create the data source in the GUI of RDM first, and then use the data source in the Devolutions.PowerShell module.

Best regards,

Richard Boisvert

avatar

Hello,

In the meantime, you can set the value after creating the data source:

$ds = New-RDMDataSource ...
Set-RDMDataSourceProperty -DataSource $ds -Property "TrustServerCertificateMode" -Value $True
Set-RDMDataSource $ds


Best regards,

Richard Boisvert

avatar

Hi!

I get an error:

$securePW = convertto-securestring "MyPassword" -asplaintext -force
$ds = New-RDMDataSource -SQLServer -Database "myDatabase" -Username "myUsername" -Password $securePW -Server "myServer\myInstance" -Name "MyNewConnection" 
Set-RDMDataSource -DataSource $ds
Set-RDMDataSourceProperty -DataSource $ds -Property "TrustServerCertificateMode" -Value $True
Set-RDMDataSource $ds
[Error] The operation was canceled.


But when I run Get-RDMDataSource the datasource is listet and I can set the DS as RDMCurrentDatasource and all works fine.

For me there is no need to set the option with the New-RDMDataSource command. Setting after creation with Set-RDMDataSourceProperty is all i need.

Thank you!

CU,
Timo

avatar

Hello Timo,

I'm glad to see the workaround is good enough! I will still leave the other request since doing it all in one cmdlet would be helpful.

Best regards,

Richard Boisvert