Enhancing Data Security with Azure Key Vault and Azure SQL Database

Rafael Rampineli
4 min readSep 4, 2024

--

Transparent Data Encryption (TDE) is a feature used to encrypt SQL Server databases to protect data at rest.
TDE encrypts the data and log files of a SQL Server database at the storage level, without requiring changes to applications. This encryption is transparent to applications, meaning that existing applications do not need to be modified to interact with the encrypted database.

Transparent Data Encryption (TDE) helps protect Azure SQL Database, Azure SQL Managed Instance against the threat of malicious offline activity by encrypting data at rest. It performs real-time encryption and decryption of the database, backups, and transaction log files.

By default, TDE is enabled for all newly deployed SQL Databases . TDE performs real-time I/O encryption and decryption of the data at the page level.
It encrypts the storage of an entire database by using a symmetric key called the Database Encryption Key (DEK).

So, Why are we configuring own customer Managed Keys if Azure do this by default? Because, with sensitive data, we may not be comfortable the Azure managing the vault and key.

TDE cannot be used to encrypt system databases, such as the master database and it’s recommended to not store any sensitive data in the system databases.

Good to Know:

Existing SQL databases created before May 2017 and SQL databases created through restore, geo-replication, and database copy are not encrypted by default, and existing SQL Managed Instance databases created before February 2019 are not encrypted by default.

Developing TDE with Azure Key Vault for SQL Database:

  • Configuring Azure Key Vault

Azure Key Vault is a cloud service offered by Microsoft Azure that provides secure storage and management of sensitive information, such as secrets, encryption keys, and certificates. It’s designed to help organizations safeguard critical data and manage cryptographic keys used for data encryption.

*use same region used by Azure SQL Database

  • Maybe it’s necessary give some Access control Key Vault administrator

Azure IAM (Identity and Access Management) is a comprehensive suite of features in Azure that helps you manage access to resources securely and efficiently.
The Key Vault Administrator role is a predefined role designed to manage Azure Key Vault resources. This role provides the necessary permissions to configure and manage the Key Vault itself, including its secrets, keys, and certificates.

  • Configuring Key in Key Vault

A key refers to a cryptographic key used for encryption, decryption, and signing operations. Azure Key Vault helps manage these keys securely, ensuring that sensitive information remains protected and that cryptographic operations are performed safely.

  • Configuring SQL Database TDE with Azure Key Vault

Using Transparent Data Encryption (TDE) with Azure Key Vault for SQL Database and SQL Database Managed Instances, provides a secure and compliant solution for managing encryption keys. It enhances security by keeping keys separate from the data they protect, simplifies key management, and supports automated key rotation

After a configuration:

Now, if you need copy SQL Database to another SQL Server, you need to repeat step “Configuring SQL Database TDE with Azure Key Vault” on new SQL Server using same Key Vault.
Example:

Using Transparent Data Encryption (TDE) with Azure Key Vault improves the security and compliance of SQL Databases by centralizing the management of encryption keys and keeping them separate from the data they protect. This approach makes it easier to rotate and manage keys. Azure Key Vault supports automatic key rotation and integrates well with other Azure services, ensuring consistent security practices.

This approach helps meet regulatory requirements for data protection and reduces the risk of exposure by avoiding hardcoding secrets and keys in your code. It also makes it easy to integrate with Azure services and other applications, and allows secure access to secrets, keys, and certificates through APIs and SDKs.

--

--

Rafael Rampineli
Rafael Rampineli

Written by Rafael Rampineli

I specialize in managing and optimizing complex database environments to ensure high availability, performance, and data integrity.

No responses yet