Power BI is one of the best tools for building interactive dashboards, and PostgreSQL is one of the most powerful open-source databases. Whether you're running PostgreSQL locally or on a managed cloud service like Aiven, connecting the two unlocks advanced analytics capabilities for your applications, business systems, or data engineering workflows.
In this article, you'll learn:
✔ How to connect Power BI to PostgreSQL running locally
✔ How to connect Power BI to Aiven PostgreSQL (cloud-powered)
✔ How to install required drivers
✔ How to configure SSL for Aiven
✔ The exact steps, screenshots (optional), and commands you need
**
Prerequisites
**
Before connecting Power BI to PostgreSQL, ensure you have:
- Power BI Desktop
- PostgreSQL installed (for local option)
- Aiven PostgreSQL service (for cloud option)
- Npgsql .NET Data Provider (required by Power BI)
- Ability to install certificates (for Aiven)
Part 1: Connect Power BI to PostgreSQL (Local)
** Step 1 — Install the PostgreSQL Driver (Npgsql)**
Power BI needs the Npgsql ADO.NET provider to communicate with PostgreSQL.
Download & install the latest version here:
_
https://www.npgsql.org/download.html_
After installing, restart Power BI Desktop.
**
Step 2 — Confirm PostgreSQL Is Runnin**g
Default local PostgreSQL settings:
Host: localhost
Port: 5432
Username: postgres
Password: your_password
Database: your_database
Test using DBeaver, pgAdmin, or psql:
SELECT version();
Step 3 — Connect Power BI to Local PostgreSQL
In Power BI:
- Go to Home → Get Data → More
- Search for PostgreSQL Database
- Click Connect
Enter:
_Server: localhost:5432
Database:
_
Under Data Connectivity Mode, choose:
- Import (recommended for performance)
Authentication:
- Database
- Enter your username and password
Click OK → Select your tables → Load.
You’re now connected to PostgreSQL locally.
Part 2: Connect Power BI to PostgreSQL on Aiven (Cloud)
Aiven PostgreSQL connections require:
- SSL encryption
- Trusted CA certificate
- Correct hostname & port ** Step 1 — Download the Aiven CA Certificate**
In your Aiven dashboard:
- Open your PostgreSQL service
- Go to Overview → Connection Information
- Download: CA Certificate (ca.pem)
Step 2 — Install the CA Certificate (Windows)
Power BI cannot connect until the CA certificate is trusted.
Steps:
- Press Win + R, type certmgr.msc
Go to:
_
Trusted Root Certification Authorities → Certificates_Right-click → All Tasks → Import
Select ca.pem
Complete the wizard
Restart Power BI Desktop
**
Step 3 — Retrieve Your Aiven PostgreSQL Credentials**
Example Aiven connection parameters:
Host: pg-yourproject-12345.aivencloud.com
Port: 12345
Database: defaultdb
User: avnadmin
Password:
SSL: Required
**
Step 4 — Connect Power BI to Aiven PostgreSQL**
In Power BI:
- Home → Get Data → PostgreSQL Database
- Server:
pg-yourproject-12345.aivencloud.com:12345
- Database: defaultdb
- Click OK, then:
✔ Enable SSL
Check the option:
Require SSL (encrypted connection)
Authentication:
Database
Enter Aiven username & password
Click Connect.
If the certificate is installed properly, Power BI will show your tables.
Your cloud PostgreSQL database is now connected!
Power BI Service (Publishing) Notes
Connecting Local PostgreSQL:
Requires installing an On-Premises Data Gateway
(if you plan to refresh the dataset online).
Connecting Aiven PostgreSQL:
✔ No gateway needed
✔ Works over encrypted SSL directly
✔ Scheduled refresh supported instantly
Top comments (0)