Based on this discussion and additional research, here’s my analysis of database encryption best practices for ERP workloads:
TDE and Always Encrypted (Azure SQL Database):
Azure SQL offers two primary encryption mechanisms:
Transparent Data Encryption (TDE):
- Encrypts entire database at rest (data files, log files, backups)
- Completely transparent to applications - no code changes required
- Service-managed keys enabled by default, customer-managed keys (CMK) optional
- Key stored in Azure Key Vault, database has identity-based access to retrieve key
- Performance impact is negligible (< 3-5% overhead)
- Recommended for: General-purpose ERP database encryption meeting compliance baselines
Always Encrypted:
- Encrypts specific columns with encryption/decryption at client side
- Protects data from high-privilege users (DBAs, cloud admins)
- Requires application changes (Always Encrypted-enabled driver)
- Two modes: deterministic (allows equality comparisons) and randomized (more secure)
- Performance impact varies based on query patterns (10-30% for encrypted column operations)
- Key hierarchy: Column Encryption Key (encrypts data) protected by Column Master Key (stored in Key Vault)
- Recommended for: Highly sensitive columns (SSN, credit cards, salary) where zero-trust for DBAs is required
For ERP implementations, the typical pattern is TDE with CMK for the entire database, plus Always Encrypted for a small subset of highly sensitive columns. This balances security, compliance, and operational overhead.
Customer-Managed Keys (CMK) Strategy:
Both Azure SQL and Cosmos DB support CMK via Key Vault, but implementation differs:
Azure SQL with CMK:
-- Enable TDE with customer-managed key
ALTER DATABASE [ERP-Production]
SET ENCRYPTION ON
WITH (ENCRYPTION_KEY = 'ERP-TDE-Key' FROM KEY_VAULT 'vault-name');
Key rotation procedure:
- Create new key version in Key Vault
- Update database encryption protector to new key version
- Database automatically re-encrypts DEK (Database Encryption Key) with new KEK (Key Encryption Key)
- No downtime required
Cosmos DB with CMK:
- Enable CMK at account creation or update existing account
- Point to Key Vault URI and grant Cosmos DB managed identity access
- All data, indexes, and backups encrypted with CMK automatically
- Key rotation: Update Key Vault key version, Cosmos DB automatically uses new version
- No manual intervention required
Compliance Certifications:
For SOC2 and HIPAA compliance:
Required Controls:
- Encryption at rest with customer-managed keys (both services support this)
- Encryption in transit with TLS 1.2+ (both services enforce this)
- Key access audit logging (Key Vault diagnostic logs to Log Analytics)
- Key rotation procedures documented and tested (quarterly recommended)
- Principle of least privilege for key access (RBAC on Key Vault)
- Backup encryption with same key protection (both services include this)
Azure SQL Advantages for Compliance:
- Always Encrypted provides additional control for high-sensitivity data
- Dynamic data masking for non-production environments
- SQL Audit logs capture all database operations
- Row-level security for multi-tenant ERP scenarios
Cosmos DB Advantages for Compliance:
- Simpler key management (no separate CMK per database)
- Automatic encryption of all components (no configuration required)
- Built-in geo-replication with consistent encryption
- Lower operational overhead for multi-region deployments
Operational Overhead Comparison:
Azure SQL TDE + CMK:
- Initial setup: 2-3 hours (Key Vault, managed identity, TDE enablement)
- Key rotation: 30 minutes quarterly (automated scripts recommended)
- Monitoring: Key Vault access logs, database encryption status
- Backup considerations: Automated backup encryption included
Azure SQL Always Encrypted:
- Initial setup: 1-2 weeks (application code changes, driver updates, testing)
- Key rotation: 2-4 hours per rotation (requires application restart)
- Monitoring: Column encryption key usage, application-side decryption metrics
- Development overhead: All queries against encrypted columns require special handling
Cosmos DB CMK:
- Initial setup: 1-2 hours (Key Vault, managed identity, CMK enablement)
- Key rotation: Automatic (Cosmos detects new key version)
- Monitoring: Key Vault access logs
- Backup considerations: Fully automated
My Recommendation for ERP Workloads:
Use Azure SQL Database with TDE and customer-managed keys for core ERP transactional data. This provides:
- ACID transactions required for financial data
- Compliance-grade encryption with customer control
- Minimal operational overhead
- Familiar relational model for ERP schemas
Add Always Encrypted for specific sensitive columns only if:
- Regulatory requirements mandate protection against privileged user access
- You have engineering resources to modify application code
- The performance impact is acceptable for your query patterns
Reserve Cosmos DB for ERP scenarios requiring:
- Global distribution with low-latency reads (multi-region ERP deployments)
- Flexible schema for rapidly evolving data models
- Massive scale (millions of transactions per second)
For most traditional ERP implementations, Azure SQL with TDE+CMK provides the optimal balance of security, compliance, and operational simplicity. The encryption is transparent, the compliance story is clear, and the operational overhead is manageable. Add Always Encrypted selectively based on specific regulatory requirements rather than as a default approach.