# How do you run a query against data the database can't read?

DevFeed: [How do you run a query against data the database can't read?](<https://devfeed.tech/articles/how-do-you-run-a-query-against-data-the-database-can-t-read-124116.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/azure-sql/how-do-you-run-a-query-against-data-the-database-cant-read/>)

Author: Anna Hoffman

Published: 2026-11-09T11:56:57Z

Content type: article

Language: en

Sources: [Azure SQL Dev Corner](<https://devfeed.tech/sources/azure-sql-dev-corner.md>)

Topics: [Azure SQL](<https://devfeed.tech/topics/azure-sql.md>), [sql-server](<https://devfeed.tech/topics/sql-server.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Database](<https://devfeed.tech/topics/database.md>), [enterprise data protection](<https://devfeed.tech/topics/enterprise-data-protection.md>), [database-optimization](<https://devfeed.tech/topics/database-optimization.md>)

Tags: [adversary](<https://devfeed.tech/tags/adversary.md>), [aes](<https://devfeed.tech/tags/aes.md>), [application](<https://devfeed.tech/tags/application.md>), [attestation](<https://devfeed.tech/tags/attestation.md>), [azure](<https://devfeed.tech/tags/azure.md>), [azure-sql](<https://devfeed.tech/tags/azure-sql.md>), [azure-sql-database](<https://devfeed.tech/tags/azure-sql-database.md>), [b-tree](<https://devfeed.tech/tags/b-tree.md>), [b-tree-index](<https://devfeed.tech/tags/b-tree-index.md>), [benchmarking](<https://devfeed.tech/tags/benchmarking.md>), [client](<https://devfeed.tech/tags/client.md>), [client-driver](<https://devfeed.tech/tags/client-driver.md>), [confidential-computing](<https://devfeed.tech/tags/confidential-computing.md>), [encryption](<https://devfeed.tech/tags/encryption.md>), [encryption-at-rest](<https://devfeed.tech/tags/encryption-at-rest.md>), [has](<https://devfeed.tech/tags/has.md>), [hyperscale](<https://devfeed.tech/tags/hyperscale.md>), [microsoft](<https://devfeed.tech/tags/microsoft.md>), [microsoft-sql](<https://devfeed.tech/tags/microsoft-sql.md>), [query](<https://devfeed.tech/tags/query.md>), [research](<https://devfeed.tech/tags/research.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

Always Encrypted lets Azure SQL run queries over data whose keys remain outside the database server. A client driver encrypts parameters and decrypts results using a column encryption key (CEK), itself protected by a customer-controlled column master key (CMK). Deterministic encryption supports equality comparisons and ordinary B-tree indexes but leaks value frequency; randomized encryption avoids that leakage but requires secure enclaves for comparisons, ranges, BETWEEN, and LIKE. Enclaves decrypt and evaluate data in protected memory, with attestation required before clients share keys. The article says leakage remains: deterministic comparisons reveal frequency, while enclave range and indexed LIKE queries can reveal ordering and proximity. VBS enclaves are available across Azure SQL Database offerings but currently lack attestation, so they do not match the paper's stronger threat model; Intel SGX with Azure Attestation remains stronger. SQL Server 2022 added enclave JOIN, GROUP BY, and ORDER BY. The paper's 2020 TPC-C results show overhead, and the article advises benchmarking current workloads.

## Source excerpt

Under the Hood: The Research Behind Microsoft SQL, part 3 Encryption at rest solves one threat. It stops someone who walks off with the disk. It does nothing about someone with administrative access to the running server, because the database decrypts data into memory to do anything useful with it. For a lot of workloads [...] The post How do you run a query against data the database can't read? appeared first on Azure SQL Dev Corner.