Give Read Only Access to Azure SQL Database
To give read only access to azure sql database, create a database user first. Then, add that user to the built-in data reader role. This setup lets people and AI agents read tables without changing data. It protects your system from bad writes or accidental drops. You can set this up for a single database or across a server. How to give read only access to azure sql database In SQL Server systems, a database user represents an identity inside a database. Teams have two main ways to set up thi
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 give read only access to azure sql database, create a database user first. Then, add that user to the built-in data reader role. This setup lets people and AI agents read tables without changing data. It protects your system from bad writes or accidental drops. You can set this up for a single database or across a server.
How to give read only access to azure sql database
In SQL Server systems, a database user represents an identity inside a database. Teams have two main ways to set up this user identity. If a person needs many databases, admins create a login in the master database. Then they link a database user to that central login. If someone needs just one database, a contained database user works well. A contained user has a password inside the target database itself. It does not need a login in the master database. An admin must turn on contained databases on the server and database first.
Once the user exists, admins assign permissions using fixed database roles. The system includes a fixed role made for reading data. Members of the data reader role can read all user tables and views. You cannot change the rules assigned to these fixed database roles. Every role, including the public role, holds the basic permission to connect. Admins add the new user as a member of the data reader role. For extra safety, a deny data writer role also exists. That role blocks a user from adding, changing, or deleting any table data. This setup works the same for human engineers and automated AI agents.
Security and operational tradeoffs of static read roles
Fixed database roles handle basic table permissions well, but gaps remain. A member of the data reader role can read every user table. They can also read every view inside that database. If a table holds sensitive customer records, the reader gets all of it. Emails, phone numbers, card numbers, and national IDs return in plain text. Fixed roles cannot rewrite matched fields in query results on the fly.
Static database users also create work for operations teams over time. Engineers and AI tools often store passwords in local files. If a key leaks, an attacker gets full read permissions right away. Admins must rotate passwords and clean up old users by hand. When someone only needs ten minutes to check a bug, static roles keeps the session active. The user keeps full read rights day and night until someone removes them. Also, shared logins make it hard to see who ran a specific query. Teams need a way to inspect queries and mask data during active sessions.
Auditor Read-Only Access + Database Access Proxy: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Managing database sessions with stronger controls
Modern teams pair database roles with session-level controls for better safety. Instead of giving every engineer a static database user, teams route queries centrally. This approach checks identity before any query reaches the database. It also lets teams apply data masking to sensitive columns in real time. When a query runs, masking rewrites matched fields like emails or card numbers. Engineers and AI agents get the rows they need to fix issues. At the same time, sensitive customer details stay protected in the output.
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 login and a database user?
A login lives in the master database and handles server-level sign-in. A database user is the identity of that login inside one specific database. Contained users skip the master login and sign in directly to one database.
Can I change the permissions of the built-in data reader role?
No, you cannot change the permissions assigned to fixed database roles. The data reader role always grants read access to all user tables and views. If you need custom rules, you must create a custom role instead.
How do I stop a user from reading or writing data right away?
You can add the user to the deny data reader role to block reads. To block writes, add the user to the deny data writer role. Members of the deny data reader role cannot read user tables or views.
Related guides
In this post