Skip to content

1.5. File Retention

Jimmy Bourque edited this page Nov 30, 2026 · 1 revision

Français

Transaction file retention and cleanup

Purpose

The transaction-working and transaction-tracing Azure Blob Storage containers contain temporary transaction files created while processing jobs and recording processing traces.

The transaction-working container is used for temporary, just-in-time files required during active transaction processing. These files should be removed as soon as they are no longer needed by the processing workflow, subject to the lifecycle policy and any operational recovery requirements.

The transaction-tracing container is used for short-term retention of transaction traces needed for investigation, debugging and operational support. It should not be treated as a permanent business-record or archival storage location.

These files are useful for:

  • monitoring the status of a transaction;
  • investigating processing failures;
  • diagnosing operational problems; and

They are not intended to be retained indefinitely. Keeping old files increases storage usage and may retain user-related information longer than necessary.

Recommended retention period

Configure an Azure Blob Storage lifecycle management policy with separate retention periods: automatically delete files older than 2 days in transaction-working and older than 30 days in transaction-tracing.

The retention periods are recommendations and must be validated against the application's operational, legal, support and privacy requirements. The value [n] represents the number of days selected for a container. For the current recommendation:

transaction-working:  [n] = 2 days
transaction-tracing:  [n] = 30 days

The 2-day period is appropriate for just-in-time working files because they are intermediate processing artifacts. The 30-day period provides time to investigate recent processing problems using transaction traces while limiting the retention of files that are primarily used for temporary investigation and debugging.

Why automatic cleanup is required

Manual deletion is easy to forget and does not provide a reliable retention control. A lifecycle management policy applies the cleanup rule at the storage-account level and can be filtered to the appropriate containers or blob paths.

Automatic deletion helps to:

  • limit the amount of personal or user-generated information retained in traces;
  • reduce the risk associated with old diagnostic data;
  • control storage costs; and
  • make the retention rule repeatable and auditable.

Example Azure lifecycle policy

The following example deletes block blobs in transaction-working after 2 days without modification and in transaction-tracing after 30 days without modification:

{
  "rules": [
    {
      "enabled": true,
      "name": "DeleteOldTransactionWorkingFiles",
      "type": "Lifecycle",
      "definition": {
        "filters": {
          "blobTypes": [
            "blockBlob"
          ],
          "prefixMatch": [
            "transaction-working/"
          ]
        },
        "actions": {
          "baseBlob": {
            "delete": {
              "daysAfterModificationGreaterThan": 2
            }
          },
          "snapshot": {
            "delete": {
              "daysAfterCreationGreaterThan": 2
            }
          },
          "version": {
            "delete": {
              "daysAfterCreationGreaterThan": 2
            }
          }
        }
      }
    },
    {
      "enabled": true,
      "name": "DeleteOldTransactionTracingFiles",
      "type": "Lifecycle",
      "definition": {
        "filters": {
          "blobTypes": [
            "blockBlob"
          ],
          "prefixMatch": [
            "transaction-tracing/"
          ]
        },
        "actions": {
          "baseBlob": {
            "delete": {
              "daysAfterModificationGreaterThan": 30
            }
          },
          "snapshot": {
            "delete": {
              "daysAfterCreationGreaterThan": 30
            }
          },
          "version": {
            "delete": {
              "daysAfterCreationGreaterThan": 30
            }
          }
        }
      }
    }
  ]
}

Important configuration detail

The transaction-working and transaction-tracing containers are hosted in the same Azure Storage Account. Configure one lifecycle rule for each container, using the corresponding container name as the rule scope. Do not configure them as prefixes inside a different container.

Before enabling the policy, confirm:

  1. the exact storage account;
  2. whether the values are container names or blob prefixes;
  3. the file paths written by the generator and API services;
  4. that files are no longer required after the selected period;
  5. that support and incident-response procedures do not require a longer period; and
  6. that the policy cannot delete active transaction state needed by the application.

Relationship with transaction processing

Transaction files may still be required after a job finishes for a limited period. The API can use transaction state to report status or details, and tracing data can be used to investigate failures. For that reason, immediate deletion after processing is not recommended unless the application has another reliable source for those operations.

These lifecycle policies should be treated as retention limits for temporary transaction data, not as a replacement for the application's transaction-processing logic. Test the complete transaction lifecycle before enabling automatic deletion:

  1. submit a transaction;
  2. verify that the transaction can be monitored;
  3. verify that results and errors remain available as expected;
  4. verify that administrators can investigate a recent failure.

Soft delete and recovery considerations

If Blob Storage soft delete is enabled, a lifecycle policy deletion may move a blob into a soft-deleted state instead of making it immediately unrecoverable. Lifecycle management does not permanently delete blobs that are already in a soft-deleted state. The soft-delete retention period must therefore be included in the effective retention analysis.

To ensure that related data is also covered, the lifecycle policy should include deletion rules for:

  • current blob versions (baseBlob);
  • snapshots (snapshot); and
  • previous blob versions (version).

The soft-deleted copy is governed separately by the Storage Account's soft-delete setting. If the requirement is permanent deletion after exactly 2 or 30 days, the organization must separately validate the soft-delete configuration and any approved purge or recovery process. A lifecycle policy alone does not guarantee immediate permanent deletion of soft-deleted data.

If the objective is to remove personal or confidential information completely after the applicable retention period, verify the combined behavior of:

  • the lifecycle management policy;
  • blob soft delete;
  • blob versioning;
  • snapshots;
  • storage backups; and
  • any other archive or recovery process.

Monitoring and evidence

After deploying the policy, monitor its execution and retain evidence that it works. Recommended evidence includes:

  • the lifecycle policy JSON or portal configuration;
  • the date the policy was enabled;
  • the selected retention period;
  • the containers or prefixes covered by the policy;
  • periodic verification of deleted files; and
  • any exception approved for a longer retention period.

Azure lifecycle policies are evaluated periodically and may not delete a file exactly at the instant it reaches the configured age. The organization should account for this processing delay when defining its retention requirement.

Microsoft documentation

This document describes a recommended configuration. It does not confirm that the setting is suitable for every production workload. The final retention period and deletion behavior must be validated by the application owner, privacy specialist, security specialist and operations team.

Clone this wiki locally