Forum Discussion
Connect PowerBI to SQL Server - TrustServerCertificate
[System.Environment]::SetEnvironmentVariable('PBI_SQL_TRUSTED_SERVERS','<servername>', 'User')
- JMLyle1 year agoAdvocate I
Sorry this last post was so brief and cryptic, but I'm glad some people were able to interpret it and get it to work.
This is a PowerShell command to set an Environment Varible. In this case, it is setting a User Environment Variable instead of a System Environment Variable ("User" is not refering to a specific user account name, it is simply "user" as opposed to "system"). System Environment Variables generaly need a high lever of access to set, but most of the time, you should be able to set a User Environment Variable for yourself.
The variable name is "PBI_SQL_TRUSTED_SERVERS."
Open a PowerShell console window, and run this:[System.Environment]::SetEnvironmentVariable('PBI_SQL_TRUSTED_SERVERS','<servername>', 'User')Where <servername> is the name of the SQL server.
You should also be able to use wildcards (*) with domain names, like "*.example.com" which would match any servers that have a Fully Qualified Domain Name that ends in .example.com:[System.Environment]::SetEnvironmentVariable('PBI_SQL_TRUSTED_SERVERS','*.example.com', 'User')
And as tralala2 points out, you should probably reboot after setting the environment variable.- JRGilbert11 months agoFrequent Visitor
This worked for me. Thanks!
- OVerplancke1 year agoNew Member
This solution worked for me.
PowerBI (much like Fabric), when using custom certificates for your internal sql servers, doesn't have the option to say "Trust Server Certificate" like you can in a traditional connectionstring.
- tralala21 year agoNew Member
Hello! I have the same issue as the OP. I tried going to Control Panel, Edit Environmnet Variables, as Johag mentioned. It didn't work, I still cannot open my SQL Server tables in PBI. Where did you input this code, JMLyle ?
- tralala21 year agoNew Member
NEVERMIND, it worked. It just needed a Restart before trying again. So use the method written by the 2 users above, but restart your computer before retrying!
🍻