Forum Discussion
Setting Up TLS Between Power BI Report Server and PostgreSQL Using Npgsql
Hi Valerio, great question !
Prerequisites :
- Power BI Report Server installed and configured
- PostgreSQL server with TLS (SSL) enabled
- Npgsql ADO.NET provider installed (should be version-compatible with Report Server and PostgreSQL)
- TLS certificate(s) on the PostgreSQL server
- Access to the client machine where Power BI Report Server is running
On your PostgreSQL server, ensure that TLS is enabled. This is typically done in the postgresql.conf and pg_hba.conf files:
**postgresql.conf**
conf
ssl = on
ssl_cert_file = 'server.crt'
ssl_key_file = 'server.key'
ssl_ca_file = 'root.crt' -- (optional but recommended for client-side validation)
**pg_hba.conf**
conf
hostssl all all 0.0.0.0/0 cert
Then, restart PostgreSQL.
Then you need to verify taht the PostgreSQL certificates (server.crt, server.key, and optionally root.crt) are:
- In the PostgreSQL data directory (or specify absolute paths)
- server.key must be 600 permission (chmod 600 server.key)
In Power BI Report Server, when setting up a data source with Npgsql, use a connection string like:
Host=your_postgres_server;Port=5432;Username=your_user;Password=your_password;Database=your_db;SSL Mode=Require;Trust Server Certificate=false;Root Certificate=c:\\certs\\root.crt