SQL Server Management Studio Create Read Only User

Published
Length
3 min read

Luis Felipe Dias

All posts

To complete a sql server management studio create read only user workflow, map a login to a database user. Then add that database user to the fixed data reader role so it can only read tables. This setup lets engineers and AI agents query production data without changing or deleting records. It separates server access from database rules so admins can control each layer on its own. How the sql server management studio create read only user workflow works SQL Server splits access into two dis

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 complete a sql server management studio create read only user workflow, map a login to a database user. Then add that database user to the fixed data reader role so it can only read tables.

This setup lets engineers and AI agents query production data without changing or deleting records. It separates server access from database rules so admins can control each layer on its own.

How the sql server management studio create read only user workflow works

SQL Server splits access into two distinct steps. First, an admin creates a login at the server instance level in the master database. That login lets a person or script connect to the server instance itself.

Second, the admin creates a database user inside a specific target database. A database user is the identity of that login when it connects to a database. For people who need access to many databases on an instance, a user with a login is common.

Teams that only need access to one or a few databases have another option. They can set up a contained database user with a password inside the target database itself. This user is not tied to a login in the master database. An admin must first enable contained databases on both the server and the database. SQL Server supports thirteen types of database users in total.

Once the database user exists, it belongs to the public role and has basic connection rights. To grant read access, an admin adds the user to the fixed data reader role. Members of this fixed role can read all data from all user tables and views.

The permissions assigned to fixed database roles cannot be changed. If a team wants to block write actions for sure, another fixed role denies data changes. Members of that deny role cannot add, modify, or delete data in any user table. Avoid the database owner role for read tasks, because it can drop the database.

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 credentials in active sessions

Fixed database roles solve one problem well. They stop a person or AI agent from running write queries that change or drop tables. Still, a read role still exposes every row and column in all user tables and views by default.

When an engineer or script connects with a read user, the session can read sensitive fields. Customer emails, phone numbers, card numbers, and national IDs return in plain text by default. A fixed read role cannot rewrite or mask those fields inside query results on its own.

Static passwords also create operational work for platform teams. Engineers often save database passwords in local client profiles or agent config files. If a person leaves the team, admins must rotate that shared password or drop the user. Doing this across dozens of database instances takes time and risks breaking active apps.

Auditing also remains difficult when multiple people or bots share one read login. Server logs show the shared login name, not the real person who ran the query. To fix this, teams need identity controls and field masking between the client and the database. Masking rewrites matched fields like emails and card numbers in query results during the session.

Add runtime guardrails beside SQL Server

Role grants and network rules are needed setup for SQL Server. Still, an allowed user or agent tool can send a bad delete or read raw customer fields over a valid session. In practice, hoop.dev sits inline in the TDS protocol beside the database as a sidecar for your SQL Server. For every query an agent or human runs in production, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev SQL Server controls, rules refuse banned statements before they run, hold risky queries for human review, and mask matched sensitive values in supported result columns in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for HIPAA, PCI DSS, SOX, and GDPR audits. See the source on GitHub.

Frequently asked questions

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

A login authenticates a person or app at the server instance level in the master database. A database user is the identity of that login inside one specific database and holds role permissions.

Can you change the permissions of the fixed data reader role?

No, the permissions assigned to fixed database roles in SQL Server cannot be changed. The fixed data reader role always grants read access to all user tables and views in that database.

When should a team use a contained database user for read access?

A contained user works well when a person or agent needs access to one or a few databases. It authenticates at the database level with a password and does not need a login in master.

The query runs. The emails stay hidden.