Azure SQL Mi Proxy vs Redirect

Published
Length
3 min read

Luis Felipe Dias

All posts

The choice of azure sql mi proxy vs redirect sets how client traffic reaches your database. Proxy mode routes traffic through a central node, while redirect sends packets straight to the host. This network choice changes latency, firewall rules, and port management for every team. Engineers and AI agents need fast, safe links to run daily queries. Yet network routing only solves how packets move across the wire. It does not control what happens inside the active database session itself. How a

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.

The choice of azure sql mi proxy vs redirect sets how client traffic reaches your database. Proxy mode routes traffic through a central node, while redirect sends packets straight to the host.

This network choice changes latency, firewall rules, and port management for every team. Engineers and AI agents need fast, safe links to run daily queries. Yet network routing only solves how packets move across the wire. It does not control what happens inside the active database session itself.

How azure sql mi proxy vs redirect works in practice

In proxy mode, every client session talks to a gateway node first. The gateway forwards all query traffic to the underlying database cluster node. This setup simplifies firewall rules because teams open only one standard port. Still, the extra network hop can add latency to high-volume queries.

In redirect mode, the client still starts by talking to the gateway. Once the initial handshake finishes, the gateway returns the actual cluster address. The client then opens a direct link to the node hosting the database. This direct path skips the middle hop after the first login step.

Direct links lower network latency and boost throughput for heavy workloads. The tradeoff comes down to network firewall rules and port ranges. Redirect mode requires you to open a wide range of high ports. External clients and automated agents must reach those dynamic ports directly.

Because of this, teams often pick proxy mode for outside network traffic. They reserve redirect mode for apps running inside the same virtual network. Both modes still rely on standard SQL logins and database roles after connecting.

Security tradeoffs of network routing and static roles

Network routing controls where packets travel, not what queries a user runs. Once a session connects, the database checks the login and user identity. A database user represents the login identity inside a specific database. Admins often create a login in the master database for broad access.

Database Proxy (ProxySQL, PgBouncer) + Azure RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

For access to one or a few databases, teams can use contained users. A contained user has a password and does not need a master login. An admin must enable contained databases on the server and database first. Microsoft SQL platforms support thirteen distinct types of database users in total.

After creating the user, admins assign fixed database roles to control actions. The data reader role lets a user read all user tables and views. The data writer role allows adding, deleting, or changing data in tables. A deny data reader role blocks reading from any user tables or views.

Similarly, the deny data writer role stops users from changing any table data. The database owner role can run all maintenance tasks and drop the database. You cannot change the permissions assigned to these built-in fixed database roles. Every database role, including the public role, holds the basic connect permission.

These native roles leave major gaps during live debugging and agent queries. A user with the data reader role can pull every row from tables by default. That includes sensitive emails, phone numbers, card numbers, and national IDs. Neither proxy mode nor redirect mode inspects the actual SQL commands sent.

Static database passwords also create risk when shared across teams or scripts. If an engineer or AI agent holds writer rights, one bad query hurts. Native network modes cannot pause a risky drop or delete command for review. Teams need a control layer that inspects queries and masks sensitive fields.

Govern SQL Server queries and responses in flight

Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev sits inline in the TDS wire protocol next to SQL Server as a sidecar for your SQL Server. On every production batch from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for approval.

With hoop.dev guardrails and hoop.dev data masking, banned statements are refused or held for review, matched sensitive fields in supported result columns are masked in memory, and each decision is logged. Check out the code on GitHub.

Frequently asked questions

When should a team choose proxy mode over redirect mode?

Choose proxy mode when clients connect from outside your private virtual network. It requires only one open port and avoids opening wide firewall ranges.

Does redirect mode bypass database login and role checks?

No, redirect mode still checks the login during the first gateway handshake. All fixed database roles and user permissions apply once the session starts.

Can native read-only roles hide sensitive columns like card numbers?

No, the standard data reader role grants read access to all user tables. Hiding emails, phone numbers, or card numbers requires field-level data masking rules.

The query runs. The emails stay hidden.