---
title: Azure SQL Server Configuration
slug: kron-dam-supported-databases-and-databases-clients/fj8a-azure-sql-server-configuration
docTags: 
createdAt: 2025-01-14T09:35:14.338Z
---

### Purpose&#x20;

In Azure SQL Server, similar to MSSQL, but with Azure-specific roles like MS\_ServerStateReader. The goal is to create a login and user with minimal read privileges.&#x20;

### Grant Permissions&#x20;

:::CodeblockTabs
Azure SQL Server

```sql
-- Create a server login
CREATE LOGIN [ username ] WITH PASSWORD = ’password ’;

-- Assign the ServerStateReader role to allow viewing server state
5 ALTER SERVER ROLE ## MS_ServerStateReader ## ADD MEMBER [ username ];

-- Optionally , assign the DefinitionReader role for object definitions
ALTER SERVER ROLE ## MS_DefinitionReader ## ADD MEMBER [ username ];

-- Create a database user associated with the login
CREATE USER [ username ] FROM LOGIN [ username ];
```
:::

### Testing Permissions

Connect as \[username] to the Azure SQL Server and execute:&#x20;

:::CodeblockTabs
Azure SQL Server

```sql
SELECT * FROM sys . dm_os_windows_info ;
```
:::

If the query returns data, \[username] can view the server state, indicating that permissions are set up properly.&#x20;
