SQL Server Grant View Server State
To run a sql server grant view server state request, an admin grants a server permission. This rule lets a login read live server health and active queries across the instance. Teams use this setting when people or tools need to check slow queries. It gives read access to server state views without giving full admin rights. How sql server grant view server state works in practice In SQL Server, you must split server logins from database users. A database user is the identity of a login insid
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 run a sql server grant view server state request, an admin grants a server permission. This rule lets a login read live server health and active queries across the instance.
Teams use this setting when people or tools need to check slow queries. It gives read access to server state views without giving full admin rights.
How sql server grant view server state works in practice
In SQL Server, you must split server logins from database users. A database user is the identity of a login inside one database. For people who need many databases, a login in the master database is common. For one or a few databases, a contained database user with a password is an option. An admin must first turn on contained databases on the server and the database. SQL Server supports 13 types of database users in total.
Server state permissions apply at the server level, not inside one single user database. Thus, an admin assigns this right to a server login inside the master database. Once set up, engineers and AI agents can read system views to check memory use. They can also see active sessions, wait stats, and query plans during an incident.
Standard read roles work at a lower level than server state permissions. For example, members of the fixed reader role can read all data from user tables. They can also read all user views inside that one database. Still, that database role does not let a user inspect server-wide health metrics. Teams often pair database read roles with server state rights for full diagnostic visibility.
Security and operational tradeoffs of static roles
Assigning static server and database roles creates clear risks for security teams. You cannot change the permissions assigned to fixed database roles in SQL Server. Every role, including the public role, has basic connect rights by default. A writer role can add, delete, or change data in all user tables. An owner role can run all maintenance tasks and even drop the database.
Kubernetes API Server Access + SQL Query Filtering: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
When you grant server state rights, the login can see query text from other users. Those active queries might hold raw emails, phone numbers, card numbers, or national IDs. A deny reader role stops a user from reading user tables and views. Yet server state views can still show sensitive values passed inside live query text.
Static logins also stay active all day and night unless an admin revokes them. Shared keys for monitoring apps or AI tools often sit in config files. If a key leaks, an attacker can read table data and server state views. Relying only on native database roles leaves gaps in audit logs and data safety. Teams need a way to inspect queries and mask sensitive fields in real time. Data masking rewrites matched fields in results before they reach the user or agent.
Managing read and diagnostic access for teams
Modern engineering teams want fast ways to check database health without sharing master passwords. Instead of creating many static logins, teams can route database traffic through a central proxy. This setup lets people log in with their normal work identity. It also lets admins approve single queries and apply data masking on the fly.
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
What is the difference between a login and a database user in SQL Server?
A login lives in the master database and lets a person enter the server. A database user is the identity of that login inside a specific database. You can also use a contained database user with a password for single databases.
Can I change the rules inside a fixed database role?
No, you cannot change the permissions assigned to fixed database roles in SQL Server. For example, the reader role always reads all user tables and views. To block table reads, an admin must add the user to the deny reader role.
Does a database reader role include server state views?
No, the fixed database reader role only reads user tables and views in one database. Server state views live at the instance level and require a separate server-level grant. Admins must grant server state rights to the login in the master database.
Related guides
In this post