Review Key Vault key expiration

Manage key lifetimes and replacement schedules explicitly.

Description

Set a Key Vault key’s expiration_date to its permitted lifetime. At expiry, Key Vault stops using that version for new encryption and signing operations.

Potential impact

Apps that still reference the expired version may be unable to protect new data.

Remediation

Switch consumers to a new key version before expiry and test their key operations. Retain the versions needed to decrypt existing data. To generate new versions automatically, configure a separate rotation policy.

Examples

The example adds a UTC expiry to the RSA key. Choose a date that fits your rotation schedule.

Before

hcl
resource "azurerm_key_vault_key" "example" {
  name         = "generated-certificate"
  key_vault_id = azurerm_key_vault.example.id
  key_type     = "RSA"
  key_size     = 2048

  key_opts = [
    "decrypt",
    "encrypt",
    "sign",
    "unwrapKey",
    "verify",
    "wrapKey",
  ]
}

After

hcl
resource "azurerm_key_vault_key" "example" {
  name         = "generated-certificate"
  key_vault_id = azurerm_key_vault.example.id
  key_type     = "RSA"
  key_size     = 2048

  key_opts = [
    "decrypt",
    "encrypt",
    "sign",
    "unwrapKey",
    "verify",
    "wrapKey",
  ]

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

References