Other Articles

Key Vault – Enforce Keys Expiration

Secure Configuration Checks > Azure

This check ensures that every key in an Azure Key Vault has an expiration date. Setting an expiration date forces keys to be rotated regularly, which limits how long a leaked or old key can be used.

Check Details

  • Resource: Key Vault
  • Check: Enforce Keys Expiration
  • Risk: Keys without an expiration date stay valid indefinitely. If a key is exposed, it can be misused for as long as it exists, and there is no prompt to rotate it.

Remediation via Azure Portal

  1. Log in to the Azure Portal. Azure Portal dashboard
  2. Navigate to Key vaults and select the affected key vault. Azure Key vaults list
  3. In the left menu, click on Keys under Objects. Keys list showing a key without an expiration date
  4. Select the key that has no expiration date, then select its current version.
  5. Select Set expiration date and choose a date and time.
  6. Click Save to apply the changes.
  7. Repeat these steps for every key and key version that has no expiration date. For new keys, select Set expiration date on the Create a key page.

Remediation via Azure CLI

  1. Open Azure Cloud Shell from the Azure Portal or use a local terminal with Azure CLI installed. Azure Cloud Shell
  2. Run the following command to list the keys in the vault:
    az keyvault key list \
    --vault-name <key-vault-name> \
    --output table
    
  3. Run the following command to set an expiration date on a key:
    az keyvault key set-attributes \
    --vault-name <key-vault-name> \
    --name <key-name> \
    --expires <expiration-date>
    

    Replace <key-vault-name>, <key-name> and <expiration-date> with your actual values. The date must be in UTC format, for example 2027-12-31T00:00:00Z. Repeat the command for each key.

Updated on 04 November, 2026