How to Configure Azure Postgres User Roles

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up azure postgres user roles by creating group roles and assigning table privileges. Then you add individual user accounts as members of those groups. Most teams start by sharing one broad admin role across several apps and engineers. That shortcut creates big risks when someone runs a bad update or reads private rows. A clear role setup limits what each person or service can read or change. How azure postgres user roles work in practice PostgreSQL manages permissions through roles th

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.

You set up azure postgres user roles by creating group roles and assigning table privileges. Then you add individual user accounts as members of those groups. Most teams start by sharing one broad admin role across several apps and engineers. That shortcut creates big risks when someone runs a bad update or reads private rows. A clear role setup limits what each person or service can read or change.

How azure postgres user roles work in practice

PostgreSQL manages permissions through roles that act as single users or groups. You can set up group roles to manage privileges when you have many users. Then you grant each person membership in the right group role. This keeps your permission rules clean as your team grows.

Every database also has a special role called PUBLIC that includes every user. By default, PUBLIC gets the right to connect to databases and create temporary tables. It also gets the right to run functions and procedures. An object owner can revoke these default rights at any time.

Schema rights matter too when you lock down a database. In PostgreSQL 15 and later, users cannot create objects in the public schema by default. Older databases, or ones upgraded from earlier versions, still allow this unless you change it. An admin fixes this by revoking the create right on the public schema from PUBLIC.

Setting up read and write boundaries

Once you lock down defaults, you build specific roles for readers and writers. A read role needs permission to view tables and views without changing data. The select privilege allows reading from an entire table or from specific columns. This same privilege also lets a user export data with the copy command.

Column rules help when a table holds both public info and secret data. You can grant select rights on safe columns and leave out secret ones. Yet managing column rules across hundreds of tables takes a lot of work. Every schema change forces an admin to check and update role grants again.

Azure RBAC + User Provisioning (SCIM): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Where native database roles fall short

Native roles decide who can log in and which objects they can touch. They do not inspect what individual queries do while a session runs. A user with read rights on a customer table can dump every row at once by default. If they have column rights, they see raw emails, phone numbers, and card numbers.

Static roles also stay active all the time until an admin revokes them. Engineers often keep write rights long after they finish fixing a bug. To close this gap, teams need controls that check queries in flight. Real-time masking rewrites matched fields like national IDs in query results without changing schemas. Statement rules can also pause risky deletes before they hit the database.

Check every Postgres query on the wire

Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres, inline in the Postgres wire protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.

Before a query runs, hoop.dev guardrails refuse bad deletes or drops with a real Postgres error, or hold risky queries for approval. On the way back, hoop.dev data masking rewrites sensitive values in returned rows in memory, and every verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.

Frequently asked questions

How should teams organize azure postgres user roles for many engineers?

Create group roles based on job tasks like read-only reporting or app writing. Grant object permissions to those groups, then add individual user accounts to the groups.

Why can new users still run functions or create objects?

The special PUBLIC role gives every user default rights to connect and run functions. Databases made before PostgreSQL 15 also let PUBLIC create objects in the public schema.

Can native PostgreSQL roles hide sensitive data inside a column?

Native select privileges can block a whole column, not rewrite parts of its text. To mask emails or card numbers in results, you need query filtering in flight.

The query runs. The emails stay hidden.