How to Configure Amazon Q SQL Server Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up amazon q sql server approval by pairing local prompt checks with database roles. Your AI coding assistant asks for user consent before it runs local shell commands or tools. Engineering teams often give AI tools a single login to speed up daily database work. When that shared login has broad rights, one bad prompt can change or drop live tables. How amazon q sql server approval works in practice Amazon Q Developer helps engineers write code, check system state, and run local comman

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 amazon q sql server approval by pairing local prompt checks with database roles. Your AI coding assistant asks for user consent before it runs local shell commands or tools. Engineering teams often give AI tools a single login to speed up daily database work. When that shared login has broad rights, one bad prompt can change or drop live tables.

How amazon q sql server approval works in practice

Amazon Q Developer helps engineers write code, check system state, and run local commands. When the agent needs to query a database, it uses a local command or tool. The developer tool can pause and ask the human user to approve the action first. This step forms the first layer of control on the developer machine.

Once the human approves the step, the tool connects to the database using a login. In SQL Server, a login in the master database maps to a specific database user. For access to one or a few databases, admins can also enable contained database users. A contained user has a password tied to the database itself rather than master. Microsoft offers thirteen distinct types of database users to match different identity needs.

Database admins control what this user can do by assigning fixed database roles. The read role lets a user read all data from all user tables and views. The write role lets a user add, delete, or change data across all user tables. A deny write role blocks the user from adding, changing, or deleting any table data. An owner role can run all maintenance tasks and can even drop the whole database. Admins cannot change the base permissions assigned to these fixed roles.

What native roles and local prompts solve

Local command prompts stop the AI agent from running surprise tasks in the background. The developer gets a chance to read the proposed command before it leaves the workstation. Pairing this prompt with a read role stops the agent from changing table rows. If the agent tries to delete rows, the database rejects the command right away.

This native setup works well when the AI tool only needs to read safe test tables. It also keeps setup simple because admins use standard database logins and fixed roles. Teams do not need to write custom role rules for basic read tasks.

Where database roles and local checks fall short

Local prompts rely on busy humans to read every command with total focus. After approving ten safe commands, a developer often clicks approve out of habit. If the AI tool needs a write role to fix data, the risk grows fast. Once logged in with a write role, the user can change any user table.

Approval Chains & Escalation + Kubernetes API Server Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Fixed database roles decide who logs in and what broad actions they can take. They do not inspect what individual statements do while a session is live. A read role still reads all user tables, which may hold emails or card numbers. Masking tools must rewrite matched fields in results so sensitive strings stay protected. A native role alone cannot ask a second team lead to approve one risky update.

Separating read checks from write actions

Safe teams split AI database tasks into two distinct paths based on risk. For daily debugging and schema checks, the agent uses a read user with deny write roles. This blocks accidental table changes while the agent inspects views and table structures.

When the agent must fix a row or run a migration, it needs extra review. Relying only on a local IDE prompt leaves live data open to human fatigue. Teams need a review step that checks the exact SQL statement before it runs. They also need clear logs showing which user and prompt ran each query.

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. It reads plain batches and parameterized queries on the TDS wire while passing Windows login through untouched.

Before a batch hits the server, hoop.dev guardrails check the statement against your rules. Disallowed actions get a native TDS error with your message. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns that match your rules. Every query and decision is logged. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can SQL Server fixed database roles require approval per query?

No, fixed database roles grant standing rights to read or write all user tables. They do not pause individual queries to ask a human reviewer for consent.

How do you keep an AI agent from modifying SQL Server tables?

Assign the database user to the fixed read role and the deny write role. This lets the agent read user tables while blocking all data changes.

Why is a local IDE prompt not enough for production SQL Server tasks?

Local prompts only check action consent on the developer laptop and depend on human focus. They do not enforce central team sign-off or mask sensitive emails and phone numbers.

The query runs. The emails stay hidden.