Skip to main content

Security Controls Comparison

TDE, Always Encrypted, RLS, DDM, Auditing — five features, five different problems. This page makes it clear what each one does, what it doesn't do, and when to use them together.

For detailed configuration, see Encryption & Network Security and Authentication & Authorization.


The Matrix

FeatureWhat It ProtectsEncryption?Who Can Still See Data?Azure SQL DBMIVMExam Weight
TDEData at rest (files, backups)✅ AES-256Anyone with DB access (decrypted transparently)✅ ON by default🎯 High
Always EncryptedSpecific columns (in use)✅ Client-sideNot even the DBA or SQL engine🎯 High
RLSRow-level accessOnly rows matching your predicate🎯 High
DDMColumn display (masking)Users with UNMASK permission🎯 Medium
AuditingActivity tracking (who did what)Auditors reviewing logs🎯 High

What Problem Does Each Solve?

Threat / ProblemFeatureHow It Helps
Stolen database files or backupsTDEFiles are encrypted — useless without the key
DBA shouldn't see salary/SSN dataAlways EncryptedData encrypted before reaching SQL engine — DBA sees ciphertext
Tenant A shouldn't see Tenant B's dataRLSFilter predicate hides rows per user/tenant
Support staff shouldn't see full credit card numbersDDMShows XXXX-XXXX-XXXX-4321 instead of full number
"Who deleted those records?"AuditingLogs every query, login, schema change to storage/Log Analytics
Compliance requirement for encryption at restTDESatisfies encryption-at-rest checkbox
Compliance requirement for column-level encryptionAlways EncryptedColumn never exists in plaintext on server
GDPR "right to know who accessed my data"AuditingFull access trail per user per query

Where Does Encryption Happen?

FeatureEncrypted Where?Decrypted Where?Key Location
TDEStorage layer (data files, log, backups)SQL engine (transparent to queries)Server certificate or Azure Key Vault
Always EncryptedClient app (before sending to SQL)Client app (after receiving from SQL)Client-side key store (Key Vault, cert store)
TLS 1.2Network (in transit)SQL engine / clientCertificate on server
🎯 Exam Focus

The critical distinction: TDE encrypts data at rest — anyone who can query the database sees plaintext (decryption is transparent). Always Encrypted encrypts data in use — even the DBA and SQL engine see only ciphertext. TDE protects stolen files. Always Encrypted protects from privileged users.


Who Can Still See the Data?

RoleTDEAlways EncryptedRLSDDM
DBA / sysadmin✅ Sees plaintext❌ Sees ciphertext✅ Sees all rows (unless filtered)✅ Sees unmasked
App with correct keys✅ Sees plaintextDepends on predicate✅ Sees unmasked
App without keys❌ Ciphertext onlyDepends on predicateSees masked
User with UNMASKDepends on predicate✅ Sees unmasked
User without UNMASKFiltered rows onlySees masked
Someone with stolen .mdf file❌ Encrypted❌ EncryptedN/AN/A
Azure platform admin❌ (with BYOK)N/AN/A
⚠️ Watch Out

DDM is not security — it's obfuscation. Users with SELECT permission and UNMASK can see full data. Users can also infer values through WHERE clauses (e.g., WHERE SSN = '123-45-6789'). DDM prevents casual viewing, not determined access.


Configuration Complexity

FeatureSetup EffortOngoing MaintenanceImpact on Queries
TDE1 min (ON by default in Azure)None (auto key rotation with service-managed)Zero — completely transparent
Always EncryptedHigh (client driver changes, key management)Key rotation requires planningCan't use WHERE, JOIN, ORDER BY on encrypted columns (deterministic exception)
RLSMedium (write predicate function + policy)Update predicate when tenant model changesSlight overhead on every query
DDMLow (ALTER TABLE ADD MASKING)Minimal — masks are declarativeZero overhead
AuditingLow (enable in portal)Storage management, log reviewMinimal overhead (< 5%)

Always Encrypted: Deterministic vs Randomized

Encryption TypeAllows Equality Checks?Allows Range/LIKE?Use For
DeterministicWHERE col = @valueColumns you need to search (SSN, email)
RandomizedColumns you only display (salary, notes)
🎯 Exam Focus

Deterministic Always Encrypted allows equality comparisons (=, IN, GROUP BY, JOIN) because the same plaintext always produces the same ciphertext. Randomized doesn't allow any server-side operations — it's more secure but less functional.


Common Combinations

CombinationWhat It Achieves
TDE + AuditingStandard compliance baseline — encryption at rest + full audit trail
TDE + RLSMulti-tenant isolation with encrypted storage
TDE + Always EncryptedAt-rest encryption + column-level protection from privileged users
RLS + DDMRow filtering + column masking for defense-in-depth
TDE + RLS + DDM + AuditingFull security stack for regulated industries
Always Encrypted + AuditingSensitive column protection + activity tracking
🏢 Real-World DBA Note

Most production deployments use: TDE (on by default) + Auditing (compliance requirement) + RLS (if multi-tenant). Always Encrypted is used selectively for the most sensitive columns (SSN, payment data) because of its query limitations.


Common Exam Traps

TrapReality
"TDE protects data from DBAs"❌ TDE is transparent — DBAs see plaintext. Use Always Encrypted to protect from DBAs.
"DDM prevents data access"❌ DDM only prevents casual viewing. UNMASK permission or inference attacks bypass it.
"Always Encrypted works with all queries"❌ Only deterministic encryption allows equality checks. No LIKE, no range queries, no ORDER BY.
"RLS protects data at rest"❌ RLS is a query-time filter. Someone with file access bypasses it entirely. Combine with TDE.
"Auditing prevents attacks"❌ Auditing detects and logs — it doesn't prevent. It's for accountability, not access control.
"TDE needs to be turned on manually in Azure SQL DB"❌ TDE is ON by default in Azure SQL DB. You only need to act if using BYOK (customer-managed key).

Decision Guide

"I need to..."Use This
Encrypt the entire database at restTDE (already on)
Prevent the DBA from reading salary dataAlways Encrypted
Show different data to different tenantsRLS
Hide credit card digits from support staffDDM
Track who accessed what and whenAuditing
Use my own encryption key (not Microsoft's)TDE with BYOK via Key Vault
Protect data in transitTLS 1.2 (always on)
Satisfy PCI-DSS requirementsTDE + Always Encrypted + Auditing + RLS

Anti-Patterns

  • "TDE is enough for compliance." TDE protects files-at-rest, not the live query path. Auditors ask for who saw the data, which is Auditing, not TDE. PCI/HIPAA fail with TDE-only.
  • "Always Encrypted on every PII column." Randomized AE breaks WHERE, ORDER BY, JOIN, LIKE, indexes. Apps that don't know the column key get cryptic conversion errors at runtime. AE is for the handful of columns the DBA must not see, not a blanket policy.
  • "DDM = data protection." DDM is a presentation mask. Any user with UNMASK or with SELECT and a WHERE predicate can infer values. Treat DDM as UI-layer convenience, not a control plane.
  • "RLS for multi-tenant isolation, no other layer needed." RLS is a query-time WHERE injection. A user with db_owner or direct file access bypasses it. Pair with permission boundaries and per-tenant credentials.
  • "Turn on Auditing later when we need it." Audit logs are not retroactive. The breach window is exactly the unaudited window. Default-on Auditing to Storage costs cents/month — always cheaper than a forensic gap.
  • "BYOK because it's more secure than service-managed TDE." BYOK adds operational risk: rotating, revoking, or losing the Key Vault key takes the database offline. Use BYOK only when required by policy, not as a default upgrade.
⚠️ Watch Out

Always Encrypted with Secure Enclaves (VBS) is the only way to do range queries / pattern matching on encrypted columns. Plain Always Encrypted does not support these and never will. If a question allows WHERE col LIKE '%x%' on encrypted data, the answer is enclaves, not classic AE.


Migration Between Controls

From → ToPathCost
Service-managed TDE → BYOK (Key Vault)Add CMK, switch protectorOnline; rotation now your responsibility
BYOK → Service-managed TDESwitch protector back to service-managedOnline; reduces operational burden
Plaintext column → Always Encrypted (deterministic)Drop indexes incompatible with AE; encrypt via SSMS / Set-SqlColumnEncryptionApplication code must use AE-aware driver; offline window during column rewrite
Always Encrypted (deterministic) → RandomizedRe-encrypt column with new typeLoses equality search; query rewrites required
Always Encrypted → Always Encrypted with EnclavesMove to DC-series VM / SQL DB BC; configure attestationAdds attestation infra + VBS-capable hardware
App-level encryption → Always EncryptedDecrypt + re-encrypt under AE keysOne-shot bulk operation; app driver swap
DDM → RLS for true row isolationAdd security predicate; remove DDMFunctional change — users now see fewer rows, not masked rows
No auditing → Auditing to Log AnalyticsEnable Diagnostic SettingPennies/GB; gain KQL queryability

Most moves are online. The expensive ones are plaintext → AE (rewrite + index drop) and classic AE → Enclaves (infra change).


Real Scenarios

  1. Healthcare app, HIPAA auditTDE (default) + Auditing to Log Analytics + RLS for clinic isolation + Always Encrypted on SSN column. Driver: separation of duties — DBA can't read SSN. Trade-off: SSN column unsearchable.
  2. Multi-tenant SaaS, 1,000 tenants in one DBRLS + per-tenant connection users + DDM on PII for support staff. Driver: tenant queries naturally filtered. Trade-off: complex security predicate, tested under load.
  3. Financial app needing range queries on encrypted amountsAlways Encrypted with Secure Enclaves on BC tier. Driver: only enclave path supports WHERE amount BETWEEN. Trade-off: BC tier cost + DC-series compute.
  4. Legacy app, no driver upgrade possibleTDE + DDM + Auditing (no AE). Driver: can't change client. Trade-off: DBA still sees plaintext — mitigate via just-in-time admin access (PIM).
  5. Net-new greenfield appService-managed TDE + Auditing + Microsoft Entra-only auth + Private Endpoint. Driver: max security with min ops. Trade-off accepted: defer BYOK until policy demands it.

Flashcards

What does TDE protect against?
Click to reveal answer
Stolen database files and backups. TDE encrypts data at rest with AES-256. It does NOT protect against authorized users querying the database — decryption is transparent.
1 / 8

Quiz

Q1/5
0 correct
A company needs to ensure that even their DBAs cannot read employee salary data stored in Azure SQL Database. Which feature should they use?