Azure SQL Firewall Service Tags
Engineers use azure sql firewall service tags to group cloud IP addresses into simple network rules. Still, the basic logical server firewall only accepts IP ranges or a broad cloud toggle, not specific tags. Teams often look for these tags when apps or AI agents need to reach a database. To filter by specific tags, you must route traffic through a virtual network and use network security groups. Even when the network path is set up, you still need strong database logins and roles. How azure
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.
Engineers use azure sql firewall service tags to group cloud IP addresses into simple network rules. Still, the basic logical server firewall only accepts IP ranges or a broad cloud toggle, not specific tags.
Teams often look for these tags when apps or AI agents need to reach a database. To filter by specific tags, you must route traffic through a virtual network and use network security groups. Even when the network path is set up, you still need strong database logins and roles.
How azure sql firewall service tags work in practice
A service tag stands for a group of IP address prefixes from a specific cloud service. The cloud provider updates these IP addresses on the back end as addresses change. This saves your team from updating IP rules by hand every week.
Still, the standard server firewall on a logical SQL server does not take service tags directly. That built-in firewall only takes static IP addresses, IP ranges, or a single switch for all cloud traffic. Turning on that global switch lets any cloud user try to log in to your server.
To use specific tags, engineers put the database behind a virtual network endpoint or private link. Then they place a network security group on the subnet and pick the exact tag they want. This setup controls how apps, scripts, and AI agents reach the network port.
Security tradeoffs of network rules and static roles
Network tags only check where a packet comes from, not who is sending the query. Many cloud services share the same tag across different teams and projects. If an attacker compromises a workload in that group, the firewall will let their traffic through.
Once traffic passes the firewall, the database checks the login and the database user. In SQL Server and Azure SQL, a database user is the identity of a login inside a database. For someone who needs many databases on an instance, a SQL user with a master login is common. For one or a few databases, admins can enable and use a contained database user with a password. In total, there are 13 types of database users available to admins.
Azure RBAC + Firewall Configuration: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
After creating the user, admins assign fixed database roles to control what queries can run. You cannot change the permissions built into these fixed database roles. Every role, including the public role, has basic permission to connect. 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. Meanwhile, the database owner role can run all maintenance tasks and can even drop the database.
These static roles leave big gaps during an active session for engineers and AI agents. A user in the data reader role can pull every row from sensitive tables by default. The firewall and role cannot mask emails, phone numbers, card numbers, or national IDs on the fly. You need query-level controls and data masking, which rewrites matched fields in results before they leave the network.
Better ways to control database queries and sessions
Relying on IP rules and broad roles creates extra work for platform teams. Every time a developer works from a new coffee shop, someone must update a firewall rule. Every time an AI agent runs a task, a wide network rule keeps the session active all day.
A modern approach moves security closer to the user identity and the actual SQL query. Instead of opening network ports to whole cloud regions, teams keep the database on a private network. Users and bots log in with their single sign-on identity for short sessions. You can approve dangerous commands one by one and rewrite sensitive fields in query 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
Can I add a service tag directly to the standard SQL server firewall?
No, the basic server firewall only takes static IP ranges or a broad cloud switch. To filter by a specific service tag, you must use virtual network rules and network security groups.
Does a read-only database role hide sensitive columns from AI agents?
No, the fixed data reader role lets the user read all data in all user tables and views. To hide emails, phone numbers, or card numbers, you need a tool that rewrites matched fields in results.
How do admins block a user from reading or changing table data?
Admins can place the user into the deny data reader or deny data writer fixed roles. The deny data reader role stops the user from reading data or metadata from any user table or view.
Related guides
In this post