Microsoft SQL Server (MSSQL) Configuration
3 min
Purpose
In MSSQL, the aim is to create a login and user with minimal read privileges, such as VIEW SERVER STATE, and optionally the ability to view object definitions if required.
Grant Permissions
CREATE LOGIN [ username ] WITH PASSWORD = ’<password >’;
GRANT VIEW SERVER STATE TO [ username ];
CREATE USER [ username ] FROM LOGIN [ username ]; -- Under each database that will be connected to.Testing Permissions
Connect as [username] and execute:
SELECT * FROM sys . dm_os_sys_info ;If [username] can see the system info, it confirms that VIEW SERVER STATE is functioning correctly.