← Back to Projects

Certificate and Secret Lifecycle at Scale

Rotating a shared TLS certificate across dozens of services, distributing host keys and triaging expiring secrets

Platform: AKS + Key Vault
Scope: Multiple environments
Focus: Change safety
Role: Change owner

Overview

Expired certificates and secrets are among the most avoidable causes of outages. This page covers three pieces of lifecycle work: a shared TLS certificate renewal that also changed the certificate's filename, a host-key rollout to every environment, and a repeatable way to triage expiring app-registration secrets.

The Challenge

Architecture

Key Vaultcert + app settingsCSI drivermounts filesPod volumeApp readsfilename from settings
The filename couples the Helm mount and the app setting

Implementation

  1. Scope tightly: change only the target environments' values, on a dedicated branch.
  2. Update settings in bulk: one script updated the filename across dozens of app-settings secrets in a single, controlled pass.
  3. Respect approvals: when the change was approved for one environment only, the other environment's values were held back until its own change request.
  4. Host keys: created the expected SFTP host-key secret in every environment and verified the pods. That caught one environment that pointed at a different SFTP provider and needed that provider's published fingerprint.
  5. Expiring secrets: triaged app-registration secret-expiry alerts by checking sign-in activity, pipeline usage and Graph, then recommending rotate, delete or suppress.
bulk settings update (illustrative)
$secrets = Get-AzKeyVaultSecret -VaultName $vault | Where-Object Name -like '*-appsettings'
foreach ($s in $secrets) {
    $v = Get-AzKeyVaultSecret -VaultName $vault -Name $s.Name -AsPlainText
    Set-Content "backup/$($s.Name).json" $v                      # back up first
    $new = $v -replace 'old-cert-name\.pfx', 'new-cert-name.pfx'
    if ($new -ne $v) {
        Set-AzKeyVaultSecret -VaultName $vault -Name $s.Name `
            -SecretValue (ConvertTo-SecureString $new -AsPlainText -Force) | Out-Null
    }
}

Key Outcomes

Lessons Learned

Conclusion

Rotating a certificate is easy. Rotating it across dozens of services, several approval scopes and every environment without an outage takes sequencing and discipline.

Technologies Used

Azure Key VaultKey Vault CSI DriverHelmAKSPowerShell (Az)Entra IDMicrosoft GraphAlertingChange Management

About this case study: this write-up is drawn from my hands-on platform engineering experience. Organisation names, system names, figures and timelines have been changed or generalised, and all code, configuration and queries are illustrative examples written for this page.

← Keyless CI/CD with OIDC for TerraformObservability: Noise, Gaps and Blind Spots →
← Back to Projects Get in Touch