SQL Server Authentication Mode

Published
Length
3 min read

Luis Felipe Dias

All posts

A sql server authentication mode controls how people and apps log in to a database instance. It checks who you are before it maps your login to a specific database user. Teams rely on these login checks to protect data from bad actors. Both human engineers and automated tools must pass this check before they run any queries. How sql server authentication mode works in practice When an engineer or AI agent connects, the server checks their login details first. A database user is the identity

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.

A sql server authentication mode controls how people and apps log in to a database instance. It checks who you are before it maps your login to a specific database user.

Teams rely on these login checks to protect data from bad actors. Both human engineers and automated tools must pass this check before they run any queries.

How sql server authentication mode works in practice

When an engineer or AI agent connects, the server checks their login details first. A database user is the identity of that login inside a single database. SQL Server supports 13 types of database users to handle different access needs.

For people who need many databases on an instance, a login in master is common. That central login then maps to a SQL user inside each target database. This setup lets one account move across several databases on the same server.

Sometimes an app or contractor only needs one or a few databases. In that case, a contained database user with a password is an option. This user lives inside the database and does not tie to a login in master. An admin must first turn on contained databases on the server and the database.

Once inside the database, fixed roles control what the user can do. Every role, including the public role, holds the basic right to connect. You cannot change the built-in rules assigned to fixed database roles.

Members of the data reader role can read all data from all user tables and views. Members of the data writer role can add, delete, or change data in user tables. The database owner role can run all maintenance tasks and even drop the database.

K8s API Server Authentication + SQL Query Filtering: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Admins can also block actions with deny roles. A deny data reader role stops a user from reading any user tables or views. A deny data writer role blocks a user from adding, changing, or deleting table data.

Security tradeoffs of static logins and roles

Choosing the right login setup is only the first step in database security. Static passwords for SQL users often end up in config files or team chat logs. When many people share one login, audit logs cannot show who ran a bad query.

Fixed database roles also create broad risk during an active session. A data reader role lets a user read every single user table and view. You cannot edit that fixed role to hide one sensitive column or table.

If an engineer or AI agent holds data reader rights, they pull raw rows back. Those query results often include emails, phone numbers, card numbers, or national IDs. Native login checks stop strangers at the door, but they do not filter active query results.

Database admins also struggle to manage standing rights over time. Engineers switch teams, and temporary debug scripts stay active for months. Without query-level checks and data masking, one stolen login exposes every table in the database. Masking rewrites matched fields in results so sensitive values stay safe during live queries.

Check SQL Server batches and results on the wire

SQL Server logins and roles decide who connects. They do not check what each TDS batch does or mask sensitive values in returned rows. With hoop.dev, you run an open-source proxy, a sidecar for your SQL Server, inline in the TDS wire protocol. On every batch an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Before a batch hits the server, hoop.dev guardrails refuse disallowed actions with a native TDS error or hold risky statements for approval. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns in memory, and every decision is logged. Explore the MIT-licensed project on GitHub.

Frequently asked questions

What is the difference between a SQL Server login and a database user?

A login sits at the server level inside the master database to verify your identity. A database user is the identity of that login when it connects to one database. You need a login for many databases, or a contained user for just one.

Can you change the permissions of fixed database roles in SQL Server?

No, you cannot change the permissions assigned to built-in fixed database roles. For example, the data reader role always grants read access to all user tables and views. If you need custom table rules, you must build your own custom roles instead.

How do contained database users work without a master login?

A contained database user stores its password inside the specific target database itself. It does not link to a server-level login inside the master database. An admin must enable contained databases on the server and database before creating one.

The query runs. The emails stay hidden.