Azure SQL Authentication

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up azure sql authentication by matching a login or contained user to a database. Once inside, database roles decide what tables that user or AI agent can read or write. Teams need a clear plan to manage how people and tools log in to databases. When you understand users and roles, you can keep your data safe and your work fast. How azure sql authentication works for engineers and AI agents A database user is the identity of a login when it connects to a database. The system supports

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 authentication by matching a login or contained user to a database. Once inside, database roles decide what tables that user or AI agent can read or write.

Teams need a clear plan to manage how people and tools log in to databases. When you understand users and roles, you can keep your data safe and your work fast.

How azure sql authentication works for engineers and AI agents

A database user is the identity of a login when it connects to a database. The system supports thirteen types of database users for different needs. When people need many databases on an instance, a SQL user with a master login helps. That master login sits at the server level and links to user accounts inside each database.

You can also use a contained database user for one or a few databases. A contained user is a SQL user with a password, not tied to a master login. An admin must enable contained databases on the server and the database before you use this. Both human engineers and automated AI agents use these identities to start a database session.

After the login step passes, the database checks the roles tied to that user account. All roles, including the default public role, hold the basic right to connect. Teams then add users to fixed database roles to grant read or write permissions. Note that you cannot change the permissions assigned to fixed database roles.

Members of the data reader role can read all data from all user tables and views. Members of the data writer role can add, delete, or change data in all user tables. If you want to block reads, the deny data reader role stops all table reads. It also hides metadata about those user tables and views from the user.

The deny data writer role stops a user from adding, changing, or deleting any table data. At the top level, the owner role can run all setup and maintenance tasks. Members of the owner role can even drop the whole database in SQL Server.

Azure RBAC + Multi-Factor Authentication (MFA): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Security and operational tradeoffs in active sessions

Static logins and fixed database roles solve the first step of database access control. They verify who is logging in and set broad rules at the table level. Still, fixed roles apply to all user tables and views at once. A user in the data reader role can read all column in every user table by default.

This creates a tough problem when engineers debug live issues or AI agents run queries. A read role gives full access to raw customer rows inside those user tables. If a table holds emails, phone numbers, card numbers, or national IDs, queries return them.

Shared passwords for SQL logins or contained users also create extra work for security teams. When an engineer leaves or a key leaks, teams must rotate passwords across many apps. Static roles also lack a step to pause and check risky write commands before they run.

Why query-level controls matter for production data

Database roles work best when you pair them with controls that inspect live queries. Instead of relying only on broad table roles, teams can check each command in flight. This helps when an engineer needs to fix one row without holding full owner rights.

Data masking is another key piece for safe read sessions. Masking rewrites matched fields like emails, phone numbers, and card numbers in query results. This lets developers and AI tools query real production tables while protecting sensitive customer columns.

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

A standard SQL user links to a login stored in the master database. A contained database user has its own password inside the target database and needs no master login. This makes contained users a good fit when someone needs one or a few databases.

Can I customize the permissions of fixed database roles?

No, you cannot change the permissions assigned to fixed database roles. For example, the fixed data reader role always grants read access to all user tables and views. If you need custom rules, you must build your own roles or use query-level controls.

How do deny roles interact with read and write access?

The deny data reader role blocks a user from reading data or metadata in user tables. The deny data writer role stops a user from adding, changing, or deleting data in user tables. Teams use these roles to strictly block actions for specific database users.

The query runs. The emails stay hidden.