Azure SQL Firewall

Published
Length
4 min read

Luis Felipe Dias

All posts

An azure sql firewall blocks network traffic unless an IP rule allows the client. It checks the source IP address before any user login or query runs. This network check acts as the first gate for database traffic. Once a client passes this gate, database logins and roles take over. Teams must manage both network rules and database roles to keep data safe. How the azure sql firewall works in practice Every request to the database hits the network filter first. The system checks the client IP

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.

An azure sql firewall blocks network traffic unless an IP rule allows the client. It checks the source IP address before any user login or query runs.

This network check acts as the first gate for database traffic. Once a client passes this gate, database logins and roles take over. Teams must manage both network rules and database roles to keep data safe.

How the azure sql firewall works in practice

Every request to the database hits the network filter first. The system checks the client IP address against a list of allowed ranges. If the address matches a rule, the request reaches the login stage. If the address does not match, the server drops the request right away.

Engineers and AI agents need a valid path through this network gate. Remote staff often change locations, which changes their home IP addresses. Cloud apps and AI agents also run on dynamic hosts with shifting addresses. Teams end up updating IP rules often or opening broad network ranges.

Passing the network check is only the first step for a client. Next, the client must log in to the database. A database user represents the identity of a login when it connects. For people who need many databases on an instance, a login in master is common.

For access to one or a few databases, a contained database user is an option. This user has a password and does not tie to a login in master. An admin must first enable contained databases on the server and the database. Across the platform, there are 13 types of database users available.

Security tradeoffs of network rules and static roles

An IP rule only proves where a packet came from on the network. It does not check who is typing or what query they plan to run. Once a client passes the network gate, static credentials and roles control the session.

Admins often assign fixed database roles to control what users can do. Members of the datareader role can read all data from all user tables and views. Members of the datawriter role can add, delete, or change data in all user tables. A user in the owner role can do all setup and maintenance tasks. The owner role can even drop the database.

Azure RBAC + Firewall Configuration: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Admins can also block actions with deny roles. A deny datareader role stops users from reading any data from user tables and views. It also blocks reading metadata about those objects. A deny datawriter role stops users from adding, changing, or deleting data. All roles, including the public role, have basic connect rights. The rights assigned to these fixed database roles cannot be changed.

This setup leaves a large gap during an active session. A read role lets an engineer or AI agent read every row in every table by default. Network rules and broad roles cannot filter out sensitive columns on the fly. Queries return raw emails, phone numbers, card numbers, and national IDs in full.

Data masking at the query layer helps close this gap. Masking rewrites matched fields in query results before they reach the client. Also, static roles stay active all the time. If an engineer only needs to fix one bug, a permanent write role is risky. Approving single queries or short sessions reduces the risk of bad writes or drops.

Managing access for engineers and automated tools

Modern teams run mix workloads from many places. Developers test code from laptops, while AI agents run queries from cloud containers. Managing IP rules for every person and script takes a lot of time.

When teams rely only on IP rules, they often open wide address blocks. Wide blocks weaken the network gate. When they share one static login across a team, audit logs lose clarity. You can see the database login, but not which person ran a specific query.

Tying database sessions to real user identities fixes the audit trail. Combining identity checks with query review and data masking protects tables after the network gate.

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

Does an azure sql firewall rule replace database logins and roles?

No, the network rule only checks the source IP address of the client. After the network check passes, the client must still log in with a valid login. Database roles then control what tables the user can read or change.

Can fixed database roles limit access to specific columns?

No, the permissions assigned to fixed database roles cannot be changed. The standard read role grants read rights to all user tables and views at once. Protecting fields like emails or card numbers requires extra controls or data masking.

What is the difference between a standard user and a contained user?

A standard database user ties to a server login stored in the master database. This works well for people who need access to many databases on an instance. A contained user logs in directly to one database after an admin enables the feature.

The query runs. The emails stay hidden.