Azure SQL Query Logins
You check azure sql query logins by reading system catalogs inside the master database. These system views list every server login and show which database users link to them. Teams inspect these accounts to see who can log in and run queries. Both human engineers and AI agents rely on these identities to read or change data. How azure sql query logins work in practice SQL Server and Azure SQL split identity into two distinct parts. A login sits in the master database and lets a person or app
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 check azure sql query logins by reading system catalogs inside the master database. These system views list every server login and show which database users link to them.
Teams inspect these accounts to see who can log in and run queries. Both human engineers and AI agents rely on these identities to read or change data.
How azure sql query logins work in practice
SQL Server and Azure SQL split identity into two distinct parts. A login sits in the master database and lets a person or app log in. A database user is the identity of that login inside a specific database. Microsoft supports 13 types of database users across the platform.
When someone needs access to many databases on one instance, admins create a login. That login stays in master and maps to a user in each target database. When someone needs only one or a few databases, a contained user works well. A contained database user has its own password and does not tie to master. An admin must turn on contained databases on the server and database first.
Once a login maps to a database user, admins assign fixed database roles. Every role, including the public role, holds the basic permission to connect. Members of the datareader role can read all data from all user tables. They can also read from all user views in that database. Members of the datawriter role can add, delete, or change data in user tables. The owner role can run all setup tasks and even drop the database. Admins cannot change the permissions assigned to these fixed database roles.
Security tradeoffs of static logins and roles
Auditing logins and roles tells you who can enter a database. Still, static roles leave big gaps during an active query session. A user in the datareader role can read every row in every user table by default. You cannot change that fixed role to block sensitive columns or specific commands. Admins can use a deny datareader role to block all reads across user tables. They can also use a deny datawriter role to block all data changes. Yet these broad roles act as an all-or-nothing switch for the whole database.
SQL Query Filtering + Azure RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
This creates risk when engineers or AI agents run queries on live systems. A valid read login still returns raw emails, phone numbers, and card numbers. If an engineer shares a login password, audit logs only show the shared login name. You lose track of which person actually ran a slow or risky query. Static passwords also stay active until an admin remembers to rotate or remove them.
Managing query sessions with deeper controls
Modern teams pair basic database roles with session-level controls to reduce risk. Instead of handing out long-lived passwords, teams link database access to their identity provider. This step maps every query back to a single person or bot.
Teams also inspect queries before the database runs them. If a developer needs to run a single fix, a peer can approve it first. Data masking can also rewrite matched fields like national IDs or emails in results. This approach keeps daily work safe while keeping database role setup simple.
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 database user?
A login lives in the master database and lets you log in to the server. A database user is the identity of that login inside an individual database.
When should a team use a contained database user?
Use a contained user when someone needs access to only one or a few databases. It uses its own password in the database and does not need a master login.
Can admins customize the permissions inside fixed database roles?
No, you cannot change the permissions assigned to fixed database roles in SQL Server. For example, the datareader role always grants read access to all user tables and views.
Related guides
In this post