---
title: Microsoft SQL Server (MSSQL) Configuration
slug: kron-dam-supported-databases-and-databases-clients/ogqg-microsoft-sql-server-mssql-configuration
docTags: 
createdAt: 2025-01-14T09:31:30.057Z
---

### Purpose&#x20;

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.&#x20;

### Grant Permissions&#x20;

:::CodeblockTabs
MSSQL

```pgsql
 -- Create a login at the server level
CREATE LOGIN [ username ] WITH PASSWORD = ’<password >’;

-- Grant server - level permission to view server state
GRANT VIEW SERVER STATE TO [ username ];

-- Create a user under each required database
USE [ database_name ];
CREATE USER [ username ] FROM LOGIN [ username ];

-- Optionally , grant permission to view definitions (e.g. , for
masking )
GRANT VIEW DEFINITION TO [ username ];
```
:::

### Testing Permissions&#x20;

Connect as \[username] and execute:&#x20;

:::CodeblockTabs
MSSQL

```pgsql
 SELECT * FROM sys . dm_os_sys_info ;
```
:::

If \[username] can see the system info, it confirms that VIEW SERVER STATE is functioning correctly.&#x20;
