Microsoft SQL Server Read Only User
A microsoft sql server read only user is a database identity that can query data without changing it. Admins set up this user by mapping a server login or contained identity to a read role. Teams use this setup to let engineers and AI agents inspect production data. It blocks accidental edits and drops while people debug live issues. Understanding how logins, users, and fixed roles work together helps you build safer database access. How a microsoft sql server read only user works in practice
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 microsoft sql server read only user is a database identity that can query data without changing it. Admins set up this user by mapping a server login or contained identity to a read role.
Teams use this setup to let engineers and AI agents inspect production data. It blocks accidental edits and drops while people debug live issues. Understanding how logins, users, and fixed roles work together helps you build safer database access.
How a microsoft sql server read only user works in practice
In SQL Server, a database user is the identity of a login when it connects. You can create thirteen different types of database users depending on your setup. When a person needs access to many databases on one instance, admins create a login in master. Then they map a database user to that login inside each target database.
When a user or AI agent needs access to just one database, contained users help. A contained database user holds a password right inside the database itself. It does not tie back to a login in the master database. An admin must first turn on contained databases on the server and the database.
Once the user exists, admins grant read rights through a fixed database role. The standard role for read access gives the user permission to read all user tables. It also lets the user read all views in that database. You cannot change the permissions assigned to fixed database roles.
Every role in the database, including the public role, comes with basic connect rights. If you want to block write actions for sure, you can assign a deny write role. Members of that role cannot add, change, or delete any data in user tables. You can also use a deny read role to block reads on all tables and views.
Read-Only Root Filesystem + User Provisioning (SCIM): architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Security tradeoffs of static roles and active sessions
Fixed read roles are simple to set up, but they create broad exposure in production. A user in the standard read role can read every single user table and view. You cannot edit that fixed role to hide one sensitive table from the user. If an engineer or AI agent runs a broad query, the database returns everything.
Sensitive fields like emails, phone numbers, card numbers, and national IDs come back in plain text. A read role stops data edits, but it does not stop data leaks. Static database passwords also create risk when teams share them across apps and local tools. Anyone who grabs the password gets full read access to every table in that database.
Managing these users across dozens of databases takes a lot of manual work for admins. Granting the owner role by mistake is even worse. That role lets a user run all maintenance tasks and even drop the database. Teams need a way to inspect queries and mask sensitive fields during live sessions. Putting controls in the query path lets you rewrite matched fields in results before they leave.
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 login and a contained database user?
A standard SQL user links to a server login stored in the master database. It works well when someone needs access to many databases on one server instance. A contained user keeps its password inside the target database and needs no master login.
Can I change the permissions of the built-in read role in SQL Server?
No, you cannot change the permissions assigned to fixed database roles in SQL Server. The built-in read role always allows reading all data from all user tables and views. If you need custom table rules, you must create your own custom database role.
How do deny roles interact with read and write access?
SQL Server includes fixed roles that block reading or writing data across the database. The deny write role stops a user from adding, changing, or deleting table data. The deny read role blocks a user from reading data or metadata from user tables and views.
Related guides
In this post