How to Integrate pgAdmin and Cosmos DB Safely

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair pgadmin and cosmos db to run SQL queries on cloud PostgreSQL clusters. This setup lets developers check schemas, tune indexes, and inspect distributed table rows. Azure Cosmos DB for PostgreSQL runs on open-source Postgres with the Citus extension. Because it uses the standard Postgres wire protocol, standard desktop SQL clients work well. Engineers use pgAdmin to view shards, check node health, and edit data. How data and logins flow between pgadmin and cosmos db When a developer

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams pair pgadmin and cosmos db to run SQL queries on cloud PostgreSQL clusters. This setup lets developers check schemas, tune indexes, and inspect distributed table rows.

Azure Cosmos DB for PostgreSQL runs on open-source Postgres with the Citus extension. Because it uses the standard Postgres wire protocol, standard desktop SQL clients work well. Engineers use pgAdmin to view shards, check node health, and edit data.

How data and logins flow between pgadmin and cosmos db

When a developer opens pgAdmin, the client starts a TLS link to the coordinator. The coordinator node checks the user credentials against the database role list. You can log in with native Postgres roles or cloud directory identities.

Once logged in, pgAdmin reads system catalogs to build the object tree. When a user runs a query, the coordinator parses the SQL text. It then routes the query work to the right worker nodes. The worker nodes return the rows back through the coordinator to the client.

If you use cloud directory login, the user fetches a temporary token first. The user puts that token into the password prompt inside pgAdmin. The cluster checks the token signature and matches it to a database role. This flow avoids storing static passwords inside the local client tool.

Common failure modes in shared SQL setups

Many teams start by sharing the default admin role across the whole group. This built-in role holds full superuser rights over all tables and shards. If one laptop gets breached, the attacker gains full control of production data. Shared logins also make audit logs useless during an incident review.

When five people use one account, you cannot see who dropped a table. The server log only shows the shared role name and the client IP. Another common risk comes from wide firewall rules on the cluster coordinator. Teams often open the database port to all public IP addresses for convenience.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Local client caching creates another security gap for engineering teams. By default, desktop SQL tools offer to save passwords on the local disk. If an engineer leaves the company, those saved credentials might still work. Manual key rotation takes time and often breaks running jobs by mistake.

How to scope roles and network paths

Start by creating separate database roles for read work and write work. Grant select rights only on specific schemas to the read-only role. Give developers the read role for daily debugging and schema checks. Reserve write roles for approved maintenance tasks and schema migrations.

Next, lock down the network path between user laptops and the cloud cluster. Disable public network access on the coordinator node whenever you can. Route all client traffic through private endpoints inside your virtual network. This rule stops bots on the public internet from probing your login port.

You should also enforce encrypted connections on the database cluster. Configure the server to reject any client connection that does not use TLS. In pgAdmin, set the SSL mode to verify the server certificate chain. This step stops attackers from reading SQL results on the network wire.

Finally, protect sensitive columns like emails, phone numbers, and card numbers. Data masking rewrites matched fields in results before they reach the client screen. Combine this with full query logging on the coordinator node. Good logs tell you which person ran which query at any given minute.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can pgAdmin connect to any Cosmos DB API?

No, pgAdmin only works with Azure Cosmos DB for PostgreSQL clusters. It does not support the NoSQL, MongoDB, Apache Gremlin, or Table APIs.

How do we stop engineers from saving database passwords in pgAdmin?

Switch your cluster from static passwords to cloud identity tokens with short lifetimes. You can also turn off password saving in managed pgAdmin deployments.

Do we need to connect pgAdmin to worker nodes directly?

No, you should always connect pgAdmin to the coordinator node endpoint. The coordinator manages metadata and routes queries to worker nodes for you.

The query runs. The emails stay hidden.