How to Configure Vercel AI SDK SQL Server Credentials
You set up vercel ai sdk sql server credentials by creating a database user. Then you pass those login details to the database driver inside your AI tool. Most teams start by storing a single connection string in their app settings. When the AI model runs a tool call, the app logs in with that account. If those permissions are too broad, a bad prompt can change or delete your data. Even a read-only role can expose every table to the model at once. How to set up vercel ai sdk sql server credent
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 vercel ai sdk sql server credentials by creating a database user. Then you pass those login details to the database driver inside your AI tool. Most teams start by storing a single connection string in their app settings. When the AI model runs a tool call, the app logs in with that account. If those permissions are too broad, a bad prompt can change or delete your data. Even a read-only role can expose every table to the model at once.
How to set up vercel ai sdk sql server credentials
First, you need to pick the right identity type in your database. A database user is the identity of a login when it connects to a database. SQL Server offers 13 types of database users for different needs. If your app needs many databases on an instance, use a SQL user with a login. That login lives in the master database. If the app needs one or a few databases, use a contained database user. A contained user has a password and does not tie to a login in master. An admin must enable contained databases on the server and database first.
Next, you assign that database user to a role. All database roles, including the public role, have basic connect rights. You can use fixed database roles to control what the AI tool can do. Note that you cannot change the permissions assigned to fixed database roles. To keep the AI tool from changing data, add the user to the read-only role. Members of this read-only role can read all data from all user tables and views. You can also add the deny-write role so the user cannot add, change, or delete data. Avoid the owner role, which can run all maintenance tasks and drop the database.
What native roles solve and what they leave open
Native database roles decide who can log in and which broad actions they can take. Using a read-only role stops an AI tool from dropping tables or changing rows. Using a contained database user keeps the AI app inside a single database. These steps stop the worst destructive mistakes during a model tool call.
Still, static roles do not check what individual queries do in flight. A user in the fixed read-only role can read every user table and view. If a table holds emails, phone numbers, card numbers, or national IDs, the query reads them. You can use the deny-read role, which blocks reading all user tables, views, and metadata. Yet blocking everything breaks the app, while allowing all reads exposes raw fields to the model. Also, static keys sit in your app settings until someone rotates them by hand. Every tool call from every user shares that same database identity in your logs.
Ephemeral Credentials + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Scoping table permissions and rotating keys
To reduce risk with native tools, do not rely on the fixed read-only role alone. Instead, grant select rights only on the specific views or tables your AI tool needs. Build custom views that leave out columns with emails, phone numbers, and card numbers. That way, the database user only reads the columns you put in the view. Keep the deny-write role active on the account as an extra safety net. Finally, set a calendar schedule to rotate the database password and update your app secrets.
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 runs beside the database as a sidecar for your SQL Server and checks TDS traffic without changing how clients log in.
With hoop.dev SQL Server controls, rules refuse banned statements before they run and can hold risky queries for human review. Matched sensitive values in supported result columns are masked before they reach the client. 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
Should I use a login in master or a contained database user?
Use a contained database user if your AI app only needs one or a few databases. An admin must enable contained databases on the server and the database first. Use a login in master if the app needs many databases on the instance.
Why is the fixed read-only role risky for AI tools?
Members of the fixed read-only role can read all data from all user tables and views. You cannot change the permissions assigned to fixed database roles. This means the AI tool can read tables with sensitive fields like emails or card numbers.
How do I stop the AI tool from changing data?
Do not put the user in the writer or owner roles. Add the user to the deny-write role so it cannot add, change, or delete data. Grant read rights only on the specific tables or views the app needs.
Related guides
In this post