Azure Cosmos DB
Azure Cosmos DB for NoSQL is the ION event store (ADR-0007). It is also used for projection stores that read from it. This page covers the data-protection configuration of Cosmos DB accounts, their databases and containers, and their diagnostics.
Data the resource handles
- Domain events for every aggregate, including customer and incident data. These are authoritative, append-only records.
- Projections and read models derived from events.
- Change feed leases and checkpoints.
Event stores are authoritative customer-data stores. The controls on this page apply to them in full.
Encryption at rest
- Cosmos DB encrypts all data, indexes, backups, and attachments at rest. This cannot be disabled.
- Microsoft-managed keys are the default. Customer-managed keys
(
keyVaultKeyUri) MUST NOT be enabled without a documented compliance driver, key lifecycle, outage impact, and recovery design. A revoked or unavailable key makes the account unavailable. - The event container MUST NOT set a default time-to-live until archival completeness and replay from hot plus cold history are verified, as required by Retention and deletion.
Encryption in transit
- The account MUST set the minimum TLS version to TLS 1.2.
- SDK clients connect over TLS in both gateway and direct modes. Clients MUST NOT disable certificate validation, including in local development against shared environments.
Identity and access
- Local (key-based) authentication MUST be disabled. Account keys, connection strings, and resource tokens are not used.
- Key-based metadata write access MUST be disabled, so databases and containers can only be changed through the control plane in IaC.
- Applications MUST use a user-assigned managed identity with Cosmos DB data-plane RBAC (ADR-0013).
- Role assignments MUST use the built-in data roles at the narrowest scope:
- Cosmos DB Built-in Data Reader for projection builders and query services that only read.
- Cosmos DB Built-in Data Contributor only for the service that owns writes to the store.
- Scope assignments to a database (
/dbs/{db}) or container (/dbs/{db}/colls/{container}), not the whole account, unless the service owns the whole account.
- Control-plane roles such as Contributor or DocumentDB Account Contributor MUST NOT be granted to application identities.
- Human data-plane access in
prdis break-glass only, as required by Encryption and access.
Secrets
- With local authentication disabled, there are no Cosmos DB secrets to store. Account keys MUST NOT be read into Key Vault, pipelines, or app settings as a fallback.
Backup and recovery
- The backup policy MUST be continuous, with the 30-day tier in
prdand the 7-day tier inapa,bta, andgma(ADR-0007). Point-in-time restore covers logical corruption and accidental deletion. - Zone redundancy MUST be enabled on every environment’s account (ADR-0007). It is set per region when the region is added to the account.
- The account is single-region in Switzerland North. A second region is part of the planned warm spare (ADR-0017, ADR-0018) and MUST NOT be described as available until it is deployed and tested.
prdaccounts MUST have aCanNotDeleteresource lock or Terraformprevent_destroy.- Restores MUST be tested, with drills in
gma. See Data protection procedures.
Logging and redaction
- Diagnostic settings MUST send
DataPlaneRequests,QueryRuntimeStatistics, andControlPlaneRequeststo the Switzerland North Log Analytics workspace. Resource-specific tables SHOULD be used. - Full-text query logging (
diagnosticLogSettings.enableFullTextQuery) MUST stay off. Query runtime statistics then record obfuscated query text without literal values. PartitionKeyStatisticsMAY be enabled. Partition keys are stream IDs (<AggregateType>-<AggregateId>) and MUST NOT contain personal data.- Data-access audit records required by
ADR-0021 are
written by the owning service to
IonAudit_CL, not inferred from Cosmos diagnostics.
Network exposure
- Private endpoints with public network access disabled are the target state (ADR-0007, ADR-0016). Until Phase 2 delivers them, the ZPA configuration in ADR-0025 applies.
- IP rules MUST allow only ZPA connector IPs and platform IPs, such as
Function App outbound IPs.
0.0.0.0/0MUST NOT be allowed. - Virtual network rules SHOULD be used for compute that has VNet integration.
- “Accept connections from within public Azure datacenters” (the
0.0.0.0IP rule) SHOULD NOT be enabled. If ZPA routing makes narrow IP rules impractical, it needs a recorded exception; local auth stays disabled. networkAclBypassSHOULD beNone.
Configuration reference
Properties are on Microsoft.DocumentDB/databaseAccounts. Map them to
azurerm_cosmosdb_account or azapi equivalents.
| Setting | Required value | Basis |
|---|---|---|
minimalTlsVersion | Tls12 | TLS on every hop |
disableLocalAuth | true (local_authentication_disabled in azurerm) | ADR-0007, ADR-0013 |
disableKeyBasedMetadataWriteAccess | true | Change control |
backupPolicy.type | Continuous | ADR-0007 |
backupPolicy.continuousModeProperties.tier | Continuous30Days in prd; Continuous7Days elsewhere | ADR-0007 |
locations[].isZoneRedundant | true in every environment | ADR-0007 |
locations[].locationName | Switzerland North | Residency and recovery |
publicNetworkAccess + ipRules | ZPA connector and platform IPs only (Phase 1); Disabled with private endpoints (Phase 2) | ADR-0025, ADR-0016 |
networkAclBypass | None | ADR-0025 |
diagnosticLogSettings.enableFullTextQuery | None (off) | ADR-0021 |
sqlRoleAssignments | Built-in Data Reader or Data Contributor at database or container scope | ADR-0013 |
| Resource lock | CanNotDelete in prd | Residency and recovery |