How it works
How it works
A PostgreSQL scan connects entirely through the Gateway:
- Each target you list is one instance to scan. Hostnames are resolved by the gateway in the target network.
- Each target is probed on the ports of your credential accounts, so unreachable ones are skipped before any login is attempted.
- For each reachable host, discovery picks a credential account: it first tries an account whose stored host matches the target, otherwise it tries each account in turn until one connects.
- Discovery reads the roles defined on the instance.
- Each role that can log in is staged as a PostgreSQL account scoped to that instance. If two instances each have a role named
postgres, Infisical stages each role as a separate account.
Prerequisites
Before creating a PostgreSQL discovery source, make sure you have:- A Gateway (or Gateway pool) with network access to the instances you want to scan.
- One or more PostgreSQL accounts in PAM to use as credential accounts. Discovery connects to each instance as one of these accounts, using its port, database, and TLS settings.
- The Product Admin role on your PAM project.
The PostgreSQL role used for the scan only needs permission to log in to the target instance. It doesn’t need superuser privileges or additional grants to list the roles on that instance.
Step 1: Create a source
1
Go to Privileged Access Manager > Discovery and select Add Source.
2
Choose PostgreSQL, then select Next.

3
Configure the source:

4
Select Add Source. The source appears in the Discovery table.
Discovery only finds roles that can log in to the scanned instance. Group roles that exist purely to hold privileges can’t open a session, so discovery doesn’t consider them accounts and ignores them. Discovery also ignores PostgreSQL’s own built-in roles.Roles are cluster-wide rather than per-database, so the database your credential account connects to doesn’t change which roles are found.
Step 2: Run a scan
To trigger a scan manually, select Scan Now from the source’s row menu or its detail panel. Scans run in the background, and a source can only have one scan running at a time.
If the source is on a Daily or Weekly schedule, Infisical also scans it automatically when its interval has elapsed. Manual sources are only scanned when you trigger them.
Step 3: Import accounts
1
In the Discovery Sources table, select the source to open its detail panel.
2
From the source’s Staged Accounts tab, select the accounts you want and select Import Accounts:

3
Configure the import settings:
Then, select Import.

Once imported, the accounts become regular PAM PostgreSQL accounts in the chosen folder and inherit their template’s rules.
Next steps
Discovery Overview
Understand staging, importing, and schedules.
PostgreSQL Accounts
Learn about the account type used to authenticate scans.