Power BI Desktop connects to PostgreSQL through its built-in PostgreSQL connector. For a local server, enter the server and database names, choose Import or DirectQuery, authenticate, and select tables. A published report may also need an on-premises data gateway so Power BI Service can reach a private network. For Aiven, use the service’s assigned host, port, database and credentials, with TLS enabled; successful testing in Desktop alone does not guarantee that cloud refresh will work.
What you need before connecting
Prepare the connection details for the PostgreSQL deployment you intend to use. The required values are slightly different in practice for a computer on your local network and for an Aiven cloud service.
As an Amazon Associate I earn from qualifying purchases.
| Deployment | Server value | Port | Database and credentials | Additional requirement |
|---|---|---|---|---|
| Local PostgreSQL | Hostname or IP address reachable from the computer running Power BI Desktop | The port configured on your PostgreSQL server | Database name plus a PostgreSQL username and password, or another supported authentication method | For Power BI Service refresh, an on-premises data gateway may be required |
| Aiven for PostgreSQL | Host copied from the Aiven service overview | Copy Aiven’s assigned service port; do not assume 5432 | Database name and the service account credentials shown in Aiven connection information | Encrypted TLS connection; certificate verification requires the project CA certificate |
Power BI Desktop has included the Npgsql provider for its PostgreSQL connector since December 2019. Microsoft’s October 2024 Desktop release used Npgsql 4.0.17. On current supported Desktop versions, installing another provider is generally unnecessary and can create conflicts.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Connect a local PostgreSQL database in Power BI Desktop
1. Open the PostgreSQL connector
- Start Power BI Desktop.
- Select Home > Get data > More if PostgreSQL database is not already visible, then search for PostgreSQL database.
- Choose the PostgreSQL connector and select Connect.
2. Enter the server and database
In the connector dialog, enter the PostgreSQL server hostname or IP address in Server. If your server listens on a non-default port, use the connector’s server-and-port format required by your Desktop version. Enter the target database in Database. Use the exact names that the PostgreSQL administrator supplied; a database name is not interchangeable with a schema name.
#1 Best Overall
If PostgreSQL is running on the same computer, the server may be localhost or 127.0.0.1. A connection that works locally with that address will not automatically work from the Power BI Service, because the service cannot normally route to your private machine.
3. Choose a storage mode
Power BI offers Import and DirectQuery for PostgreSQL models where supported. Select the mode based on freshness requirements, query workload and network design rather than assuming one is universally faster.
| Decision point | Import | DirectQuery |
|---|---|---|
| Where queries run | Data is queried from PostgreSQL during refresh, then stored in the Power BI semantic model. | Report interactions send queries to PostgreSQL instead of storing all source rows in the model. |
| Freshness | Data changes appear after a refresh schedule or manual refresh. | Results can reflect source changes when visuals issue queries, subject to Power BI and source caching behavior. |
| Performance considerations | Visuals can use the imported model, while refresh consumes time and source capacity. | Visual response depends on source query performance, network latency, concurrency and capacity. |
| Typical fit | Stable reporting data that can be refreshed on a schedule. | Cases requiring more immediate source data or where importing the required volume is impractical. |
Neither mode has a guaranteed performance winner. Test representative reports and queries against your own schema, row counts, indexes and network conditions.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errors4. Authenticate
Choose the authentication method offered by the connector. Microsoft documents database username/password and Microsoft account authentication kinds. For a conventional PostgreSQL login, select the database credential option and enter the username and password permitted to read the required schemas and tables. If your organization has configured a supported Microsoft account flow, select that instead.
Power BI stores the credential for the data source in its local credential manager. Use a least-privilege PostgreSQL account rather than an administrator account, and make sure it can access every object needed by the model.
Rank #2
5. Select objects in Navigator
After authentication, Power BI opens Navigator. Expand the database and schema, tick the tables or views required by the report, and inspect the preview. Select Load to create the model immediately, or Transform Data to open Power Query and filter, rename, merge or otherwise shape the data before loading.
For repeatable reporting, prefer stable views when business logic belongs in PostgreSQL. Keep the selected object names and schema paths documented; they help you diagnose gateway mismatches after publication.
Free tools Windows power users keep installed
One-click scans. No signup required.
Encryption for a local PostgreSQL connection
PostgreSQL must support SSL before Power BI can establish an encrypted connection. Microsoft notes that the client may need the server certificate installed in the operating system’s Trusted Root Certification Authorities store. Ask the database administrator for the correct server certificate and trust-chain instructions.
Do not treat an unencrypted connection as the normal fix for certificate errors. If encryption is required by your organization, enable the connector’s encrypted-connection option and correct the server certificate, hostname, trust store or PostgreSQL SSL configuration instead.
Publish a local connection and make Power BI Service refresh it
A Desktop connection proves that the computer running Desktop can reach PostgreSQL. It does not prove that Power BI Service can reach the same address. A database on a home network, office LAN, VPN or private subnet is usually inaccessible directly from the cloud service.
1. Install or select an on-premises data gateway
Install the supported on-premises data gateway on a machine that can reach the PostgreSQL server over the network. That machine does not have to be the database host, but firewall rules, DNS, routing and VPN access must allow it to open the PostgreSQL connection.
Recommended Free Tools
The June 2025 on-premises gateway release includes Npgsql. Newer supported gateway installations therefore do not normally require a separate Npgsql installation.
2. Register the PostgreSQL data source
- In Power BI Service, open the workspace containing the published semantic model.
- Open the gateway management area and choose the gateway cluster that will perform refreshes.
- Create a PostgreSQL data source, select the PostgreSQL connection type, and enter the server and database identifiers.
- Enter credentials with permission to read the model’s tables or views, then save the data source.
The gateway’s Server and Database values must match the identifiers in the Desktop model. If Desktop used an IP address, register that same IP address rather than replacing it with a hostname. A visually similar name, alternate DNS alias or different port can prevent matching even when both values reach the same database.
3. Bind the published model to the gateway
In the semantic model’s settings, select the registered gateway and confirm that every data source is mapped. Check credentials and permissions, then run a manual refresh. Only after that succeeds should you configure a scheduled refresh.
The PostgreSQL connector supports cloud connection, virtual network data gateway and on-premises data gateway scenarios. Which option applies depends on where the database is hosted and whether the Power BI tenant can reach it without a gateway.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #4
Connect Aiven for PostgreSQL
1. Copy the service-specific connection details
Open the PostgreSQL service in Aiven Console and view its overview or connection information. Copy the exact Host, Port, Database, username and password values. Aiven assigns service ports, so entering the PostgreSQL default port 5432 by habit can connect to the wrong endpoint or fail outright.
2. Enter the endpoint in Power BI
- In Power BI Desktop, choose Home > Get data > PostgreSQL database.
- Enter the Aiven host and database. Include the assigned port when the connector requests a port or accepts a host-and-port value.
- Choose Import or DirectQuery according to the report’s freshness and workload needs.
- Authenticate with the Aiven database credentials.
- Enable the encrypted connection option, then select tables or views in Navigator and load or transform them.
Aiven requires external PostgreSQL connections to use TLS. A connection attempt that is configured as plain, unencrypted PostgreSQL should be corrected rather than worked around.
3. Choose the correct TLS assurance level
Aiven documents sslmode=require as the default requirement. This encrypts traffic in transit, but it does not validate that the certificate belongs to the intended server. Encryption and identity verification are separate properties.
| SSL mode | What it provides | What you need |
|---|---|---|
require |
Encrypts the PostgreSQL connection. | TLS support on the server; it does not verify the server certificate. |
verify-ca |
Encrypts the connection and verifies that the certificate chains to the expected certificate authority. | The Aiven project CA certificate configured where the client can trust it. |
verify-full |
Encrypts the connection, verifies the CA and checks that the certificate name matches the host. | The Aiven project CA certificate plus a hostname that matches the certificate. |
For certificate verification, obtain the project CA certificate from Aiven and configure it according to the Power BI and operating-system trust options available in your installed versions. Microsoft also notes that an encrypted PostgreSQL connection may require the server certificate in the client’s trusted root store. If verify-full reports a name mismatch, ensure that you used Aiven’s assigned hostname rather than an IP address or an unrelated alias.
Why Desktop success does not guarantee cloud refresh
Desktop runs on your computer, using its DNS, firewall permissions, VPN tunnel, installed certificates and saved credentials. Power BI Service refresh runs through the connection path configured for the published model. For a local database, that path normally includes the gateway machine; for a cloud database, it depends on the service endpoint, tenant networking and credential configuration.
- The Desktop computer may be allowed through a firewall while the gateway machine is not.
- Desktop may resolve a private hostname that the gateway cannot resolve.
- The model may contain an IP address while the gateway data source was registered with a DNS name.
- Desktop may trust a certificate installed only on that computer.
- Credentials saved in Desktop are not automatically the credentials registered for the Service data source.
Validate the complete Service path with a manual refresh before relying on a schedule or a report viewed by other users.
Troubleshooting connection and refresh failures
Desktop works, but scheduled refresh fails
- Confirm that the gateway is online and assigned to the workspace or semantic model.
- From the gateway host, verify DNS resolution and network access to PostgreSQL.
- Compare the Desktop model’s exact server and database strings with the gateway data source. Preserve an IP address if that is what the model uses.
- Re-enter the gateway credentials and confirm that the PostgreSQL account can read every selected table and view.
- Check whether the gateway host has the required trusted root certificate.
Aiven rejects the connection as unencrypted
Return to the PostgreSQL connector settings and enable encrypted connection. Aiven requires TLS for external PostgreSQL access; changing only the username or database will not solve a missing encryption setting.
Aiven reports a certificate error
First determine whether you selected require, verify-ca or verify-full. The first mode encrypts without certificate validation. The latter two need the Aiven project CA certificate, and verify-full also needs the hostname to match the certificate. Install or reference the CA in the trust store used by Power BI or the gateway, then retry with Aiven’s exact host value.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →An Npgsql or provider compatibility error appears
Record the Power BI Desktop and gateway versions. On current Desktop releases, the connector already includes Npgsql. A separately installed Npgsql assembly in the Global Assembly Cache can override the included provider. Microsoft’s compatibility note says Npgsql 4.1 and later are unsupported because of .NET compatibility. For software released before December 2019 (Desktop) or before June 2025 (on-premises gateway), the legacy manual path used Npgsql 4.0.17; do not substitute a newer 4.1-or-later build.
The connector cannot find a table
Check that Navigator is showing the intended database and schema, not a similarly named database. Confirm that the login has usage permission on the schema and select permission on the table or view. If the object was renamed after the query was built, update the navigation step in Power Query.
Version and provider boundaries
| Software situation | Provider guidance |
|---|---|
| Power BI Desktop released December 2019 or later | Npgsql is included with the PostgreSQL connector; a separate provider is generally unnecessary. |
| October 2024 Desktop release | Microsoft identifies included Npgsql version 4.0.17. |
| On-premises gateway released June 2025 or later | Npgsql is included in the gateway release. |
| Older Desktop or gateway | Manual Npgsql installation may be required; Microsoft specifies 4.0.17 for that legacy path. |
| Any environment considering Npgsql 4.1 or newer | Do not use it for this connector; Microsoft marks 4.1 and later unsupported. |
These dates describe provider packaging and compatibility, not performance or adoption. Always check the exact Desktop and gateway versions in your environment before changing installed assemblies.
A practical choice between local PostgreSQL and Aiven
Use the local workflow when the database is on infrastructure you control and the gateway can maintain reliable network access. Plan the gateway, certificate trust and matching identifiers before publishing. Use the Aiven workflow when the database is hosted as a managed service, but copy its assigned endpoint details and configure TLS rather than assuming standard PostgreSQL defaults.
In both deployments, the reliable sequence is the same: establish a secure connection in Desktop, choose the model storage mode deliberately, select and transform the required objects, publish, then validate the Service refresh path using the exact endpoint, credentials, certificates and gateway configuration that production will use.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

