Skip to main content

lacework-global-539

Configure Azure Active Directory Admin for SQL Servers (Automated)

Profile Applicability

• Level 1

Description

Use Azure Active Directory Authentication for authentication with SQL Database to manage credentials in a single place.

Rationale

Azure Active Directory authentication is a mechanism to connect to Microsoft Azure SQL Database and SQL Data Warehouse by using identities in Azure Active Directory (Azure AD). With Azure AD authentication, identities of database users and other Microsoft services can be managed in one central location. Central ID management provides a single place to manage database users and simplifies permission management.

  • It provides an alternative to SQL Server authentication.
  • Helps stop the proliferation of user identities across database servers.
  • Allows password rotation in a single place.
  • Customers can manage database permissions using external (AAD) groups.
  • It can eliminate storing passwords by enabling integrated Windows authentication and other forms of authentication supported by Azure Active Directory.
  • Azure AD authentication uses contained database users to authenticate identities at the database level.
  • Azure AD supports token-based authentication for applications connecting to SQL Database.
  • Azure AD authentication supports ADFS (domain federation) or native user/password authentication for a local Azure Active Directory without domain synchronization.
  • Azure AD supports connections from SQL Server Management Studio that use Active Directory Universal Authentication, which includes Multi-Factor Authentication (MFA). MFA includes strong authentication with a range of easy verification options — phone call, text message, smart cards with pin, or mobile app notification.

Impact

This will create administrative overhead with user account and permission management. For further security on these administrative accounts, you may want to consider higher tiers of AAD which support features like Multi Factor Authentication, that will cost more.

Audit

From Azure Portal

  1. Go to SQL servers
  2. For each SQL server, click on Active Directory admin under the Settings section
  3. Ensure that a value has been set for Admin Name under the Azure Active Directory admin section

Using Azure SQL CLI

To list SQL Server Admins on a specific server:

az sql server ad-admin list --resource-group <resource-group> --server <server>

From Azure PowerShell

Print a list of all SQL Servers to find which one you want to audit

Get-AzSqlServer

Audit a list of Administrators on a Specific Server

Get-AzSqlServerActiveDirectoryAdministrator -ResourceGroupName <resource group name> -ServerName <server name>

Ensure Output shows DisplayName set to AD account.

Remediation

From Azure Portal

  1. Go to SQL servers.
  2. For each SQL server, click Active Directory Admin.
  3. Click Set Admin.
  4. Select an administrator and click select.
  5. Click Save.

Using Azure PowerShell

For each Server, set AD Admin

Set-AzSqlServerActiveDirectoryAdministrator -ResourceGroupName <resource group name> -ServerName <server name> -DisplayName "<Display name of AD account to set as DB administrator>"

From Azure CLI

az ad user show --id 

For each Server, set AD Admin

az sql server ad-admin create --resource-group <resource group name> --server <server name> --display-name <display name> --object-id <object id of user>

References

https://docs.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication-configure
https://docs.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication
https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/get-azurermsqlserveractivedirectoryadministrator?view=azurermps-5.2.0
https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-identity-management#im-1-use-centralized-identity-and-authentication-system
https://docs.microsoft.com/en-us/cli/azure/sql/server/ad-admin?view=azure-cli-latest#az_sql_server_ad_admin_list

Additional Information

note

Assigning an Administrator in Azure Active Directory (AAD) is just the first step. When using AAD for central authentication you need to configure many other groups and roles based on the needs of your organization. Use the How-to Guides to determine roles to assign and groups to create to manage permissions and access to resources.