SQL Server Create New User with Read Only Access
To handle a sql server create new user with read only access task, you map a user identity and assign the read-only role. First, you create a server login or a contained user, and then you add that user to the fixed database reader role. This two-step design separates instance entry from database rules. A login lets a person or an AI agent enter the server instance. A database user then controls what that identity can read inside a specific database. How sql server create new user with read o
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.
To handle a sql server create new user with read only access task, you map a user identity and assign the read-only role. First, you create a server login or a contained user, and then you add that user to the fixed database reader role.
This two-step design separates instance entry from database rules. A login lets a person or an AI agent enter the server instance. A database user then controls what that identity can read inside a specific database.
How sql server create new user with read only access works
In SQL Server, a database user is the identity of a login inside a database. Microsoft offers 13 types of database users for different needs. You must pick the right type before you grant read rights.
When a team member needs to read many databases on one instance, admins create a login in the master database first. Then they create a database user tied to that master login inside each target database.
When an engineer or an AI agent only needs one or a few databases, a contained database user is another option. A contained user has its own password inside the target database and does not tie to a login in master. Before you can make one, an admin must turn on contained databases on the server and on that database.
Once the database user exists, you grant read rights through a fixed database role. Every database role, including the default public role, already has permission to connect. To allow reading, an admin adds the user as a member of the fixed data reader role.
Members of the data reader role can read all data from all user tables and views. You cannot change the permissions assigned to fixed database roles. If you also want to block write actions for sure, you can add the user to the fixed deny data writer role. That role stops the user from adding, changing, or deleting data in any user table.
Auditor Read-Only Access + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Security and operational tradeoffs of static read roles
Using the fixed data reader role is fast, but it has real limits during an active session. Because the role grants read access to all user tables and views, it is an all-or-nothing rule. A developer or AI tool with this role can query all column in every table by default.
That broad scope exposes sensitive records during live queries. If a table holds customer emails, phone numbers, card numbers, or national IDs, a read-only user still pulls those values in query results. The fixed role itself cannot rewrite or mask those fields on the fly.
Static database passwords also create ongoing work for your team. People share login keys in chat apps or store them in local files. Rotating those passwords across many apps and users takes time and can break scripts.
You can tighten control by pairing database roles with query-level inspection and data masking. When a layer sits in front of the database, it can check who runs each query and rewrite matched fields like card numbers or emails in results. This keeps day-to-day debugging simple while protecting sensitive columns from broad read roles.
Govern SQL Server queries and responses in flight
Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev sits inline in the TDS wire protocol next to SQL Server as a sidecar for your SQL Server. On every production batch from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for approval.
With hoop.dev guardrails and hoop.dev data masking, banned statements are refused or held for review, matched sensitive fields in supported result columns are masked in memory, and each decision is logged. Check out the code on GitHub.
Frequently asked questions
What is the difference between a SQL Server login and a database user?
A login lives in the master database and lets someone enter the server instance. A database user is the identity of that login inside one specific database. You can also use a contained database user with its own password for one or a few databases.
Does the fixed data reader role hide sensitive tables or columns?
No, members of the fixed data reader role can read all data from all user tables and views. You cannot change the permissions inside a fixed database role. To block all reading on a database, admins use the fixed deny data reader role instead.
How do you stop a read-only user from changing data by mistake?
Avoid adding the user to the data writer role or the database owner role. The database owner role can run all maintenance tasks and even drop the database. For extra safety, add the user to the fixed deny data writer role so they cannot add, change, or delete data.
Related guides
In this post