The Simplest Way to Make Active Directory and dbt Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You pair active directory and dbt to link user logins with data jobs. This setup lets data teams run SQL models with their own work accounts. Data teams build tables every day. They need a safe way to log in and run code. Linking your directory to your data tool solves this big problem. It maps each team member to a clear database role. You know who ran each job and what data they changed. How active directory and dbt handle user logins and roles Your directory holds every user account and g

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 pair active directory and dbt to link user logins with data jobs. This setup lets data teams run SQL models with their own work accounts.

Data teams build tables every day. They need a safe way to log in and run code. Linking your directory to your data tool solves this big problem. It maps each team member to a clear database role. You know who ran each job and what data they changed.

How active directory and dbt handle user logins and roles

Your directory holds every user account and group in your company. Your data tool turns raw data into clean tables using SQL queries. When they work together, the directory checks who the user is first. Then it passes group info to the data platform or warehouse.

In a cloud setup, teams link the directory through a standard login protocol. Users log in once with their work email and password. Group rules then assign each user to a specific project role. A junior analyst gets read access to test schemas only. A senior engineer gets write access to build new models.

Local runs work in a similar way. An engineer logs in on their laptop using their directory account. The local tool uses that active session to talk to the database. The database checks the directory group before it runs any SQL code. Data flows through the pipeline while the database logs every single query.

This setup keeps permissions in one central place. When someone leaves the team, you disable their directory account once. They lose access to the data tool and the warehouse right away. You do not have to hunt down stray accounts across five systems.

Common risks with shared accounts and broad permissions

Many teams take shortcuts when they set up their data pipelines. They create one shared service account with full admin rights. Then every developer and job runner uses that same password. This breaks your audit trail right away.

When a bad query drops a table, the logs show the shared account. You cannot tell which person or job broke the build. Shared passwords also end up in plain text files on user laptops. If one laptop gets stolen, the attacker gets full database control.

Active Directory + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Broad tokens cause another major problem. Teams often give automated jobs permissions to read every schema in the warehouse. If the job only builds marketing tables, it should not read finance data. Overly broad roles turn small bugs into huge data leaks.

To fix this, split your human roles from your job roles. Give every human user their own login tied to their directory group. Scope local dev roles so engineers only write to their own scratch schemas. Create separate, narrow service accounts for each automated job run. Make sure those job accounts can only read the exact tables they need.

Scoping network paths and protecting sensitive fields

Good role setup is only half the battle for data teams. You also need to control where queries come from on the network. Do not leave your database open to the public internet. Lock down network paths so only trusted networks can reach the data warehouse.

Next, think about the raw data inside your staging tables. Raw tables often hold private user details from production apps. Data masking rewrites matched fields like emails, phone numbers, and card numbers in results. Analysts can test their SQL logic while sensitive fields stay protected.

You should also review your query logs every week. Check which accounts run the most queries and touch private tables. Remove directory users from groups they no longer need for daily work. Small, regular checks keep your data setup clean and safe over time.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How do we map directory groups to database roles for data runs?

Create one directory group for each job function in your data team. Map each group to a matching role inside your data warehouse. Grant schema permissions to the warehouse role, not to individual user accounts.

Should developers use service accounts for local model testing?

No, developers should always log in with their own personal directory accounts. This keeps audit logs clear and stops password sharing across the team. Save service accounts for automated production runs only.

What happens when an engineer changes teams or leaves the company?

An admin updates or disables the user profile in the central directory. The next time the user tries to run a model, the login fails. You do not need to change any files inside the data project.

The query runs. The emails stay hidden.