DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
FREEDOM251

Freedom251 › Blog › Aiven

Power BI and Aiven PostgreSQL: Import, DirectQuery and Gateway Setup

By Freedom251 Team · · 12 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To connect Power BI to PostgreSQL on Aiven, copy the service’s hostname, assigned port, database, username and password from the Aiven Console, then use Power BI Desktop’s PostgreSQL database connector. Choose Import or DirectQuery, confirm the TLS settings required by Aiven, and load the model. Publishing the report is a separate step: the Power BI service must also reach the Aiven endpoint through a cloud connection or a gateway, with matching server and database values.

What you need before starting

This setup has two connection paths. Power BI Desktop connects from your computer while you build the report. After publication, Power BI Service connects independently when it queries a DirectQuery model or refreshes an Import model. A successful desktop connection therefore does not prove that scheduled refresh will work.

As an Amazon Associate I earn from qualifying purchases.

  • An Aiven for PostgreSQL service that is running and reachable from the intended client.
  • Permission to view the service’s connection information and, if necessary, change its network or access settings.
  • Power BI Desktop with the PostgreSQL connector available.
  • Database credentials that can read the schemas and tables required by the model.
  • For service refresh, either a Power BI cloud connection that can reach the endpoint or a gateway installed on a machine that can.

Keep the exact values you copy from Aiven. Do not substitute PostgreSQL’s usual default port, a hostname from a tutorial, or a local database name.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Collect the Aiven connection details

Open the Aiven Console, select the PostgreSQL service, and open its connection information or Quick connect details. The endpoint belongs to your specific service; it is not a universal Aiven address.

Value Where to get it How Power BI uses it
Hostname Aiven service connection information The server field in the PostgreSQL connector and gateway data source
Port Aiven-assigned service endpoint Part of the server address; it is often in the 10000–30000 range, not necessarily 5432
Database Quick connect or service details The database field in Desktop and the gateway
Username Service credentials Database authentication
Password Service credentials or a user-managed database password Database authentication; store it in the Power BI connection rather than in query text
Project CA certificate Aiven project certificate download, when strict verification is required Trust material for verify-ca or verify-full, subject to the exact Power BI and gateway version

Aiven requires PostgreSQL connections to use TLS. A generic connection URI is often shown in this form:

postgresql://USER:PASSWORD@HOST:PORT/DATABASE?sslmode=require

Use the real values from your service. The URI is useful for understanding the required fields, but Power BI’s connector normally asks for the server and database separately and then opens an authentication dialog.

Check network reachability first

Before troubleshooting Power BI, verify that the computer running Desktop—or the machine that will host the gateway—can reach the Aiven hostname and assigned port. Aiven projects can use public or private access controls, IP allowlists, and other network restrictions. Public access is not something to assume from the fact that the service exists.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Confirm the PostgreSQL service is running.
  • Check whether the service endpoint is public, private, or restricted to an allowlist.
  • Add the required client or gateway egress address to the project’s permitted network sources when your policy allows it.
  • Permit outbound traffic to the exact Aiven hostname and port through local firewalls, corporate proxies, and cloud network controls.

If a gateway will be used later, perform these checks from the gateway host as well as from your development computer. The two machines can have different DNS, firewall, and routing behavior.

Connect in Power BI Desktop

  1. Open Power BI Desktop and select Home > Get data > PostgreSQL database. In some releases the connector appears directly in the Get data list; in others, use the connector search box.
  2. Enter the Aiven hostname and assigned port in the server field. Use the database name from Aiven in the database field. If the connector accepts a combined server value, preserve the port exactly as displayed by Aiven.
  3. Choose a data connectivity mode: Import or DirectQuery.
  4. When prompted, select the database authentication method and enter the Aiven username and password. Do not use a cloud-console login unless it is also a valid PostgreSQL database account.
  5. Review the Navigator window. Select the schemas, tables, views, or other objects needed for the model, then choose Load or Transform data to open Power Query.
  6. Refresh a small selection first. Confirm that column types, timestamps, null handling, and row-level filters behave as expected before building a large model.

Current Power BI Desktop releases include the Npgsql provider used by this connector. Microsoft documents Npgsql support in Desktop beginning in December 2019; its October 2024 connector documentation identifies Npgsql 4.0.17 in that Desktop version. A separately installed Npgsql assembly in the Global Assembly Cache can override the bundled provider, so an old or conflicting installation can produce errors that do not occur on a clean, current Desktop installation.

When the connector or provider is missing

First update Power BI Desktop to a supported release and restart it. Check Help > About to record the Desktop version when reporting an issue. Older Desktop versions may require a compatible separate PostgreSQL provider, but installing an arbitrary Npgsql version can create a mismatch with the connector. Prefer the provider bundled with a current Desktop release unless your organization has a tested reason to use another version.

Choose Import or DirectQuery deliberately

Microsoft’s PostgreSQL connector supports both modes for Power BI semantic models. They are different operating designs, not merely two buttons with the same result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Decision area Import DirectQuery
Where data is stored A copy is loaded into the Power BI semantic model. Queries are sent to PostgreSQL when report users interact with the model.
Freshness Data changes appear after a refresh completes. Report interactions can query current source data, subject to caching and Power BI behavior.
Interaction pattern Many interactions can use the in-memory model after refresh. Visuals depend on query latency, concurrency, and source availability.
Source workload Work is concentrated during refreshes and model preparation. Report usage generates continuing queries against PostgreSQL.
Useful when The dataset fits the model and scheduled freshness is acceptable. Data must remain at the source or must be queried more frequently than practical imports allow.
Aiven-specific benchmark No Aiven-specific performance benchmark is established here. Test with your schema, indexes, row counts, concurrency, and network path.

Questions to answer before selecting a mode

  • How fresh must the report be: on a schedule, several times per day, or close to query time?
  • Can the model and its refresh window handle the required data volume?
  • Will many users open the report simultaneously?
  • Are PostgreSQL indexes, views, and permissions prepared for the queries Power BI will issue?
  • Can your Aiven plan and network path sustain the expected refresh or interactive query load?

Start with a representative subset during development, then test the chosen mode with realistic refresh sizes and report interactions. Do not infer performance from the connector’s support statement alone.

Configure TLS without weakening the connection accidentally

Aiven documents three relevant PostgreSQL SSL modes:

Mode Protection Certificate requirement Identity check
require Encrypts the connection. Does not require validation of the issuing certificate authority. Does not verify that the server is the expected Aiven host.
verify-ca Encrypts the connection. Requires the project’s Aiven CA certificate to be trusted by the client. Checks that the certificate chains to the trusted CA, but does not provide full hostname verification.
verify-full Encrypts the connection. Requires the project’s Aiven CA certificate to be trusted by the client. Checks the CA chain and that the certificate hostname matches the endpoint used.

The commonly shown Aiven URI uses sslmode=require. That protects data in transit but is weaker than CA and hostname verification because it does not establish the server’s identity. If your security policy requires identity verification, use verify-ca or preferably verify-full where the exact client supports it, and obtain the project CA from Aiven.

Power BI Desktop and the on-premises gateway do not expose identical certificate controls in every release. Microsoft notes that encrypted PostgreSQL connections may require the server certificate to be trusted on the client. Do not assume that a CA import field, environment variable, or gateway setting exists in every version. Confirm the behavior in the precise Desktop and gateway builds you operate, and test both an accepted certificate and a deliberately untrusted certificate before treating strict verification as complete.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Publish the report and plan the service connection

  1. Save the report after Desktop can load or query the required objects.
  2. Select Publish and choose the target Power BI workspace.
  3. In the workspace, open the semantic model’s settings. Look for the Gateway and cloud connections, Data source credentials, or similarly named sections; labels can vary by Power BI release and tenant configuration.
  4. Determine whether Power BI Service can reach the Aiven endpoint directly. If it can, configure the supported cloud connection and enter the database credentials.
  5. If direct service access is unavailable or prohibited, select a gateway connection and map the semantic model to the matching data source.
  6. Run a manual refresh before scheduling one. Read the refresh history and gateway logs for the first failure rather than repeatedly retrying an unchanged configuration.

The route depends on Aiven’s public or private access arrangement and your Power BI tenant’s network design. A cloud connection is not a workaround for an unreachable private endpoint; it still needs a supported network path. Conversely, installing a gateway is unnecessary when the service can securely reach the public endpoint through an approved cloud connection.

Cloud connection versus gateway

Option Choose it when What you must verify
Power BI cloud connection The Power BI service can directly reach the Aiven endpoint and your tenant supports the required PostgreSQL connection type. Endpoint reachability, credentials, TLS trust behavior, and the semantic model’s mapping to that connection.
Standard gateway mode Your organization needs a centrally managed, shared connection or the service cannot reach Aiven directly. Gateway host routing, firewall rules, service status, data-source definition, credentials, and administrator access.
Personal mode One user needs an import refresh through a gateway installation managed for that user. The user’s machine must remain available and connected; this is not a central shared-connection design.
Virtual network gateway The data source is secured in a virtual network and the tenant has an appropriate VNet arrangement. Subnet, routing, DNS, security controls, and the tenant’s supported VNet configuration.

Microsoft distinguishes standard gateway mode for centrally managed connections, personal mode for an individual user’s import refresh, and VNet gateway for data secured in a virtual network. Select the model that matches ownership and network boundaries instead of choosing a gateway type solely because Desktop connected successfully.

Set up a gateway data source correctly

For a gateway connection, install a supported on-premises data gateway on a machine that can resolve and reach the Aiven hostname and port. The gateway service, not your browser, performs the database connection during refresh.

  1. Install or update the gateway on an always-on Windows host that is permitted to make outbound connections to Aiven.
  2. Sign in to the Power BI tenant and register the gateway in the appropriate gateway cluster.
  3. In the gateway management area, add a PostgreSQL data source.
  4. Copy the server and database strings from the Power BI Desktop data-source definition. Microsoft requires these values to match the Desktop source; differences in hostname spelling, port notation, or database name can prevent mapping.
  5. Select the required authentication method and enter narrowly scoped PostgreSQL credentials. Grant only the schemas, tables, and operations needed for the model.
  6. Configure the TLS and certificate trust required by your chosen SSL mode on the gateway host. Validate the exact gateway version’s behavior rather than relying on Desktop-only settings.
  7. Use the gateway’s test or connection check, then map the published semantic model to this data source.
  8. Run a manual refresh and inspect its details before enabling a schedule.

The gateway host must be able to use the Aiven-assigned port. Aiven ports are service-specific and commonly fall in the 10000–30000 range, so a firewall rule that permits only 5432 is not sufficient unless your service actually uses that port.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Credential and access design

Create a database account for Power BI rather than reusing an administrator account. Give it read access to the required schemas and objects, and separate development credentials from production credentials. Rotate the password through your normal secret-management process, then update the Power BI cloud connection or gateway data source immediately.

  • Use a dedicated account with the minimum read permissions needed.
  • Do not place passwords in M query text, report descriptions, screenshots, or shared documentation.
  • Restrict Aiven network access to approved client or gateway egress addresses.
  • Use verify-full when your tested client and policy support CA trust and hostname validation.
  • Record which Power BI semantic models depend on each gateway source so credential rotation does not become an outage.

Troubleshoot by isolating the failing layer

“The server cannot be found” or a timeout

  • Copy the hostname and port again from the Aiven service page; do not assume the default PostgreSQL port.
  • Check DNS resolution and outbound firewall rules from the actual client.
  • Confirm that Aiven public access, private routing, and IP allowlists permit that machine.
  • If Desktop works but refresh times out, repeat the network test from the gateway host or reassess whether a cloud connection can reach the endpoint.

“Password authentication failed”

  • Verify that the username is a PostgreSQL account for the selected database, not an Aiven console identity.
  • Re-enter the password and update any saved credential in Power BI Service or the gateway after a rotation.
  • Check that the gateway data source uses the same authentication type and database as Desktop.

Desktop connects, but the published model will not refresh

  • Open the semantic model settings and confirm that it is mapped to the intended cloud connection or gateway data source.
  • For a gateway, compare the server and database strings character-for-character with the Desktop data source.
  • Check that the gateway service is online and that its host can reach Aiven’s endpoint and port.
  • Review refresh history for the first underlying error; later retries often repeat the same mapping or credential failure.

TLS or certificate errors

  • Identify which SSL mode the connection is actually requesting. require encrypts but does not validate the server certificate.
  • For verify-ca or verify-full, confirm that the Aiven project CA is trusted on the precise Desktop or gateway host making the connection.
  • With verify-full, use the hostname named by Aiven’s certificate; connecting through an unrelated alias can fail hostname validation.
  • Check Desktop and gateway versions before changing provider installations. Certificate controls and Npgsql behavior can differ by release.

The PostgreSQL connector is unavailable or behaves inconsistently

  • Record the Power BI Desktop version and update it where your organization permits.
  • Look for a separately installed Npgsql provider that could override the bundled provider.
  • On the gateway, confirm that the gateway release includes the PostgreSQL provider. Microsoft documents the provider as included beginning with the June 2025 on-premises gateway release.
  • Restart Desktop or the gateway service after provider or certificate changes, then test a minimal connection.

A practical validation checklist

Use this sequence before declaring the integration ready:

  1. The Aiven service is running, and its hostname, assigned port, database, username, and password are recorded from the service itself.
  2. The intended client or gateway host can resolve and reach that endpoint under the project’s network rules.
  3. Power BI Desktop connects through Get data > PostgreSQL database and can preview the required objects.
  4. The selected Import or DirectQuery mode matches the report’s freshness, interaction, and source-load requirements.
  5. TLS is encrypted, and certificate or hostname verification is enabled when required by policy and supported by the tested versions.
  6. The published semantic model is mapped to a valid cloud connection or gateway data source.
  7. Gateway server and database values exactly match the Desktop source.
  8. A manual service refresh succeeds, and the result is checked for row counts, timestamps, and expected filters.
  9. Only then is a recurring refresh schedule enabled.

How to choose a stable long-term design

For a small or moderate model whose data can be refreshed on a schedule, Import is often easier to operate because report interactions do not continuously query Aiven. DirectQuery is the better fit when keeping data at the source or querying more frequently is essential, but it makes report responsiveness dependent on PostgreSQL performance, network latency, concurrency, and query shape.

Use a cloud connection when the Power BI service has an approved, reliable path to Aiven. Use a standard gateway when network controls require a customer-managed bridge or when several semantic models need one centrally administered connection. Keep personal mode for genuinely individual refresh ownership, and use a VNet gateway only when the source and tenant networking are designed for it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Whichever design you select, document the Aiven endpoint, port, database, SSL mode, certificate source, Power BI mode, connection owner, and gateway host. That record turns the next credential rotation, certificate renewal, or gateway migration into a controlled change rather than a rediscovery exercise.

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.

Aivendata gatewayDirectQueryImportPostgreSQLPower BIPower BI DesktopTLS

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.