Azure SQL Select Logins

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up azure sql select logins by mapping a server login to a database user. Then you add that user to a read-only database role so they can read tables. A server login handles how a person or app logs in to the server. A database user is the identity of that login inside one specific database. When someone needs to reach many databases on one instance, a login in master is common. If they only need one or a few databases, you can use a contained database user. A contained user has its own

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.

You set up azure sql select logins by mapping a server login to a database user. Then you add that user to a read-only database role so they can read tables.

A server login handles how a person or app logs in to the server. A database user is the identity of that login inside one specific database. When someone needs to reach many databases on one instance, a login in master is common. If they only need one or a few databases, you can use a contained database user. A contained user has its own password and does not tie to a login in master. An admin must turn on contained databases on the server and database first.

How azure sql select logins work for engineers and AI agents

Both human engineers and AI agents need safe ways to run read queries. In SQL Server, there are thirteen types of database users you can set up. Every role, including the public role, gets the basic permission to connect. To let an account read rows, admins often use the fixed datareader role. Members of this datareader role can read all data from all user tables and views.

You cannot change the permissions assigned to fixed database roles. If an engineer or agent must not change rows, you pair read roles with deny roles. Members of the deny datawriter role cannot add, change, or delete any table data. If you want to block all reads, the deny datareader role stops table and view reads. It also stops the user from reading metadata about those tables and views. Admins should avoid the owner role for read tasks, since it can drop the database.

Security and operational tradeoffs of static roles

Static logins and fixed database roles solve only part of your data security needs. First, managing logins in master and users in each database takes ongoing admin work. Shared passwords for SQL users can leak in chat logs or local scripts. Second, the fixed datareader role grants read access to every user table and view.

Azure RBAC + SQL Query Filtering: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Once a session starts, that login can query sensitive columns across the whole database. Static roles cannot tell if a query comes from a safe script or a risky prompt. If a table holds emails, phone numbers, card numbers, or national IDs, a reader gets them. A basic database role does not mask those fields or ask for peer review first. Teams need controls that work inside the active session to rewrite matched fields in results.

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 server login and a database user?

A login sits in master and lets you reach the server instance. A database user is the identity of that login when it connects to a database.

When should my team use a contained database user?

Use a contained database user when someone needs access to one or a few databases. It uses a password inside the database and does not need a login in master.

Does the fixed datareader role hide sensitive columns like card numbers?

No, members of the datareader role can read all data from all user tables and views. You cannot change the permissions of fixed roles, so sensitive fields stay visible without masking.

The query runs. The emails stay hidden.