Microsoft Docs

Manage Security for Azure SQL Database

This tutorial covers essential security measures for Azure SQL Database, ensuring your data remains protected against unauthorized access and threats.

Overview of Azure SQL Security

Azure SQL Database provides a comprehensive set of security features to protect your data at rest, in transit, and during access. Understanding these features is crucial for maintaining a secure database environment.

Key security pillars include:

Authentication Methods

Azure SQL Database supports two primary authentication methods:

To learn more about configuring Azure AD authentication, see this document.

Authorization and Permissions

Once authenticated, users and applications need to be authorized to perform specific actions. Azure SQL Database uses a role-based access control (RBAC) model.

Permissions can be granted at various levels: server, database, schema, and object. It's best practice to grant the least privilege necessary for each user or application.

Common built-in roles include db_owner, db_datareader, and db_datawriter. You can also create custom database roles.

Data Encryption

Azure SQL Database offers robust data encryption capabilities:

Tip: Regularly review your encryption configurations to ensure they meet your compliance requirements.

Auditing and Monitoring

Auditing is essential for tracking database events and understanding who did what, when, and where. Azure SQL Database auditing can log:

Audited events can be sent to Azure Blob Storage, Azure Log Analytics, or Azure Event Hubs for further analysis and retention.

-- Example of enabling auditing to Blob Storage ALTER SERVER AUDIT [YourAuditName] TO (FILEPATH = 'https://yourstorageaccount.blob.core.windows.net/sqlaudit/',
RETENTION_DAYS = 90);
GO
ALTER SERVER AUDIT [YourAuditName]
STATE = ON;
GO

Firewall Rules

Firewall rules are used to control network access to your Azure SQL Database server. You can define rules at the server level or database level.

Server-level firewall rules allow or deny connections from specific IP addresses or IP address ranges. Database-level firewall rules provide more granular control.

Important: Ensure that you configure your firewall rules to allow access only from trusted IP addresses to minimize the attack surface.

For detailed instructions on configuring firewall rules, refer to the Azure SQL Firewall documentation.

Advanced Threat Protection

Azure SQL Database includes advanced threat protection features that can detect anomalous activities and potential threats, such as:

When a threat is detected, Azure SQL Database generates an alert, providing you with the necessary information to investigate and mitigate the issue.

To enable Advanced Threat Protection, navigate to your Azure SQL Database resource in the Azure portal and select "Advanced Threat Protection" under the Security section.