How to Configure Goose SQL Server Credentials
To set up goose sql server credentials, create a scoped database user and pass those login details to your agent. You should assign a read-only role so the agent cannot change or delete records. Many teams start by reusing an admin login from a local file. That shortcut gives an AI agent the power to drop tables or read private records across the server. How goose sql server credentials work with database roles SQL Server splits identity into server logins and database users. A database user
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.
To set up goose sql server credentials, create a scoped database user and pass those login details to your agent. You should assign a read-only role so the agent cannot change or delete records. Many teams start by reusing an admin login from a local file. That shortcut gives an AI agent the power to drop tables or read private records across the server.
How goose sql server credentials work with database roles
SQL Server splits identity into server logins and database users. A database user is the identity a login takes inside one database. If the agent needs many databases, teams create a login in the master database. If it needs one or a few databases, a contained database user works well. An admin must enable contained databases on the server and database first. A contained user holds its own password and does not tie to master. In total, SQL Server offers thirteen types of database users for different needs.
Once you create the user, you must assign a role. All database roles, including the public role, have permission to connect. Fixed database roles offer a quick way to set baseline rules. Note that you cannot change the permissions built into fixed database roles. For AI agents, teams often pick the fixed reader role. Members of that reader role can read all data from all user tables and views. If you want to block writes for sure, add the deny writer role. That role stops the user from adding, changing, or deleting table data. Never assign the owner role to an agent login. The owner role can run all maintenance tasks and even drop the database.
What native roles solve and what they leave open
Setting up a read-only user solves the biggest risk of accidental writes. Your agent can inspect schemas and run queries to help engineers debug issues. It cannot drop tables or wipe out rows when a prompt goes wrong. Database admins can also rotate the user password on a regular schedule.
Still, native database roles only check who logs in at the start. They do not inspect what individual queries do while the session runs. A user in the fixed reader role can still read every user table. That means the agent can pull emails, phone numbers, card numbers, or national IDs. The raw values flow right into the agent context and model logs. If you store the password on a laptop, any local tool can read it. You also lack a clear link between an engineer identity and each query. To fix this, teams need controls that work on every single query. Data masking rewrites matched fields in results before they reach the agent.
Ephemeral Credentials + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Managing local secret storage for AI agents
Engineers usually pass database passwords to local agents through workspace files or system variables. Plain text files on disk are easy to leak in version control. A better local practice is storing the secret in your operating system keychain. The system keychain keeps the password off the file system during daily work. Still, any local script running under your user account can request that secret. If a prompt tricks the agent, it can read and expose local variables. You also have to update every laptop when you rotate the database password. Shared static secrets make incident response slow and painful for security teams.
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
Should I use a master login or a contained user for Goose?
Use a contained database user if the agent only needs one database. It keeps the user isolated from the master database and other server data.
Can the fixed reader role hide specific sensitive columns?
No, the fixed reader role grants read access to all user tables and views. You cannot alter fixed roles, so you need custom grants or result masking.
How do I stop an agent from changing data by mistake?
Assign the fixed reader role and add the deny data writer role. This pairing lets the agent read tables while blocking all inserts, updates, and deletes.
Related guides
In this post