Review Azure SQL Database encryption at rest

Check encryption at rest and key management for Azure SQL Database.

Description

Transparent Data Encryption (TDE) encrypts Azure SQL Database data files, logs and backups at rest. New databases enable TDE by default. Check the state of existing and restored databases.

Potential impact

Turning off TDE removes this layer of protection if storage media or database files are exposed.

Remediation

Set transparent_data_encryption_enabled = true and verify that encryption completes. Use the service-managed key, or manage key permissions and lifecycle in Azure Key Vault if a customer-managed key is required. Configure SQL permissions and TLS separately.

Examples

The examples change only TDE on example-db. Check backup retention and test a restore.

Before

hcl
resource "azurerm_mssql_database" "app_database" {
  name                               = "example-db"
  server_id                          = azurerm_mssql_server.example.id
  transparent_data_encryption_enabled = false
}

After

hcl
resource "azurerm_mssql_database" "app_database" {
  name                               = "example-db"
  server_id                          = azurerm_mssql_server.example.id
  transparent_data_encryption_enabled = true
}

References