Azure Postgres

Instructions for configuring PowerSync for an Azure Database for PostgreSQL.

PowerSync supports both "Azure Database for PostgreSQL" and "Azure Database for PostgreSQL Flexible Server".

Prerequisites

The database must be accessible on the public internet. Once you have created your database, navigate to Settings -> Networking and enable Public access:

Enable Logical Replication

Follow the steps as noted in this article to allow logical replication:

Create a PowerSync Database User

Create a PowerSync user on Postgres:

-- SQL to create powersync user
CREATE ROLE powersync_role WITH REPLICATION LOGIN PASSWORD 'myhighlyrandompassword';
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO powersync_role;

For read-only access, only the SELECT privilege is required — INSERT, UPDATE and DELETE can be removed.

To restrict read access to specific tables, explicitly list allowed tables for both the SELECT privilege, and for the publication (as well as for any other publications that may exist).

Create "powersync" Publication

-- Create publication to replicate tables. Specify a subset of tables if required.
-- NOTE: this must be named "powersync" at the moment
CREATE PUBLICATION powersync FOR ALL TABLES;

-- Example for specifying a subset of tables:
-- CREATE PUBLICATION powersync FOR table users, projects, user_projects, checklists;

Connect PowerSync to Your Database

  1. In the PowerSync dashboard project tree, click on "Create new instance":

  1. Give your instance a name, such as "Azure Postgres Testing".

  2. Under the "General" tab, you can change the default cloud region from US to EU or JP if desired (more cloud regions are available, contact us if you need a different region).

  3. Under the "DB Connections" tab, click on the + icon.

  4. Obtain the connection details from Azure:

    • PowerSync has the relevant Azure CA certificates pre-configured — verify-full SSL mode can be used directly, without any additional configuration required.

    • The Username and Password is the powersync_role created above.

  5. Click "Test Connection" and fix any errors.

    1. If you encounter the error "must be superuser or replication role to start walsender", ensure that you've followed all the steps for enabling logical replication documented here.

  6. Click "Save".

  7. PowerSync deploys and configures an isolated cloud environment for you, which will take a few minutes to complete.

Last updated