How to Configure Semantic Kernel SQL Server Connect

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a semantic kernel sql server connect flow, link an AI plugin to a scoped database user. That database user should hold read-only role permissions so the AI agent cannot change data. Many engineering teams start by reusing a broad admin login during early tests. That shortcut gives the AI agent power to modify tables or even drop the database. How a semantic kernel sql server connect workflow works In Semantic Kernel, plugins give an AI agent the ability to run tasks against external

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 a semantic kernel sql server connect flow, link an AI plugin to a scoped database user. That database user should hold read-only role permissions so the AI agent cannot change data. Many engineering teams start by reusing a broad admin login during early tests. That shortcut gives the AI agent power to modify tables or even drop the database.

How a semantic kernel sql server connect workflow works

In Semantic Kernel, plugins give an AI agent the ability to run tasks against external data. A database plugin takes a question from the model and turns it into a SQL query. The app then uses a standard database driver to open a session with SQL Server. The driver passes a credential that maps to a specific SQL Server identity.

In SQL Server, a database user is the identity of a login inside a database. Teams can choose from thirteen types of database users when they build this setup. If the agent needs many databases on one server, a login in master is common. That login then maps to a database user inside each target database.

If the agent only needs one database, a contained database user is a good option. 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 before using this option. Once the user exists, an admin assigns permissions through fixed database roles.

How fixed database roles control agent queries

All roles in SQL Server, including the public role, hold basic permission to connect. To let the Semantic Kernel plugin read data, admins often use the fixed reader role. Members of this reader role can read all data from all user tables and views. Admins can also add the deny writer role so the user cannot change any data.

A user in the deny writer role cannot add, modify, or delete data in tables. You cannot change the permissions that belong to these built-in fixed database roles. Avoid giving the AI agent the owner role during your setup. The owner role can run all maintenance tasks and can even drop the whole database.

Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native database roles solve and what they miss

Native SQL Server roles decide who can log in and which objects they can read. This setup stops an AI plugin from running write commands if it only has read rights. Still, the fixed reader role grants read access to every user table and view. If a table holds sensitive customer data, the AI agent can pull all of it.

Admins can use the deny reader role to block access to all user tables and views. Yet fixed roles do not inspect individual queries or filter sensitive columns in flight. If a user table holds emails, phone numbers, card numbers, or national IDs, queries return them. Native logins also share one identity across the whole app, which hides which prompt ran a query. Teams need a way to inspect queries and mask sensitive fields before results return.

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 login in master or a contained user for my AI plugin?

Use a contained database user if your Semantic Kernel app only queries one or a few databases. Use a login in master if the agent needs access to many databases on the server.

Does the fixed reader role hide sensitive columns from Semantic Kernel?

No, members of the fixed reader role can read all data from all user tables and views. To hide specific columns like card numbers or emails, you need custom permissions or data masking.

Can I edit the permissions inside a SQL Server fixed database role?

No, SQL Server does not let admins change the permissions assigned to fixed database roles. If you need custom rules per table, you must create a custom role instead.

The query runs. The emails stay hidden.