Review Key Vault secret expiration

Schedule credential replacement and update its consumers.

Description

Set expiration_date on a Key Vault secret to track when to replace the credential. The issuing service may still accept the password or API key after that date.

Potential impact

Revoking the old credential too early can disconnect apps that still use it.

Remediation

Before expiry, create a replacement at the issuing service and save it as a new secret version. Switch the apps, test their connections, then revoke the old credential at the issuer.

Examples

The example keeps the same secret and tags and adds a UTC expiry. Use your actual rotation date.

Before

hcl
resource "azurerm_key_vault_secret" "example" {
  name         = "secret-sauce"
  value        = "szechuan"
  key_vault_id = azurerm_key_vault.example.id

  tags = {
    environment = "Production"
  }
}

After

hcl
resource "azurerm_key_vault_secret" "example" {
  name         = "secret-sauce"
  value        = "szechuan"
  key_vault_id = azurerm_key_vault.example.id

  tags = {
    environment = "Production"
  }

  expiration_date = "2026-12-30T20:00:00Z"
}

References