Skip to content

feat(azure-sql): Transparent Data Encryption (TDE) - #906

Merged
NitinKumar004 merged 1 commit into
developmentfrom
feat/azure-sql-tde
Aug 30, 2026
Merged

feat(azure-sql): Transparent Data Encryption (TDE)#906
NitinKumar004 merged 1 commit into
developmentfrom
feat/azure-sql-tde

Conversation

@NitinKumar004

Copy link
Copy Markdown
Collaborator

What

Adds Azure SQL Transparent Data Encryption (the Microsoft.Sql/servers/databases/transparentDataEncryption/current sub-resource) so real armsql.TransparentDataEncryptionsClient code works against the emulator.

  • New optional TransparentDataEncryptions capability on the relationaldb driver (Set/Get/List), discovered by type assertion — the cross-cloud driver is not widened.
  • A TDE record is auto-materialized as Enabled when a database is created, matching Azure's encrypted-at-rest default, so a Get/List round-trips with no explicit PUT.
  • Wire handler branches on rp.SubResourceAction == "transparentDataEncryption" inside serveDatabaseRoute; the trailing /current name segment is safely dropped by the 4-segment ParsePath, and Get vs. ListByDatabase is disambiguated on the raw path suffix.

Architecture-fit

  • Follows the existing sql sub-resource pattern (firewallRules / elasticPools): a self-contained server/azure/sql/tde.go handler + a providers/azure/sql/tde.go backend on a new memstore.Store keyed "server/database".
  • Sync-200, no LRO, no Delete — real Azure SQL TDE PUT is synchronous (the SDK method is CreateOrUpdate, not Begin…; it accepts 200/201/202 and does not poll). A 202 would be wrong; TDE also cannot be deleted, only toggled.
  • No new ARG triple: TDE is a settings sub-resource of an existing database, not a discoverable ARM resource type, so it needs no Resource Graph row.

Persistence

The TDE store bolts onto the already-Snapshottable sql Mock, which the completeness guard does not deep-check — so it was added manually to the snapshot dumps/loads lists and the sqlSnapshot struct, and the round-trip is asserted in snapshot_test.go. Cascade cleanup is wired: DeleteDatabase drops the record, and the server-delete prefix cascade (deleteChildren) covers it, so an RG purge leaves no orphans.

Test

  • Real-SDK e2e (server/azure/sql/tde_sdk_test.go): a freshly-created DB reports Enabled with no PUT; CreateOrUpdate(state=Enabled)Get round-trips; ListByDatabase returns the single current record.
  • Provider snapshot round-trip covers the auto-materialized TDE record.

Refs #611.

Add the Microsoft.Sql database transparentDataEncryption/current sub-resource
as a new optional TransparentDataEncryptions capability on the relationaldb
driver (type-asserted, not widening the cross-cloud interface). A TDE record is
auto-materialized as Enabled when a database is created; PUT/GET/List are served
synchronously (no LRO), matching real Azure SQL TDE.
@NitinKumar004
NitinKumar004 merged commit b3ab0c3 into development Aug 30, 2026
18 checks passed
@NitinKumar004
NitinKumar004 deleted the feat/azure-sql-tde branch August 30, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant