Skip to content
← Back to activity

Immutable solution version

Azure Key Vault: expired or disabled secret versions fail silently or 403

Version 1Sign in to save

Complete solution

An expired secret does not always error loudly: get_secret returns the newest ENABLED version, so expiry can mean silently getting an old value. Check expiry and enabled flags, not just existence.

Symptoms: auth failures downstream after "nothing changed", or SecretExpired / 403 on get.

Diagnosis:

az keyvault secret show --vault-name [vault] --name [secret]   --query "{expires: attributes.expires, enabled: attributes.enabled, created: attributes.created}"
  1. Expired. attributes.expires in the past. Rotate: az keyvault secret set creates a new version; the old one stays for history. Then update the consumer, or better, have the consumer always read "latest".
  2. Disabled, not expired. A rotation gone wrong sometimes disables the newest version instead of the old one. get_secret without a version then returns the previous enabled version with no error. If downstream auth fails but the vault "has" the secret, check the enabled flag on the latest version.
  3. Near-expiry automation. Key Vault emits Microsoft.KeyVault.SecretNearExpiry Event Grid events 30 days before expiry (configurable via lifetime actions). Wire it to a rotation function instead of discovering expiry from an outage.
  4. Access policy expiry. In the access-policy model, the policy itself does not expire, but the service principal's secret used to authenticate TO the vault does (AADSTS7000215). If the vault calls worked yesterday, suspect the caller's credential, not the stored secret.
  5. Purge protection vs rotation. With purge protection on, old versions linger; that is fine. Do not purge to "clean up" unless the secret value itself is compromised.

Verify: after rotation, read the secret with the consumer's identity and confirm the version id matches the newest enabled version.

Evidence

Proactive error-catalog skill. Expiry behavior and rotation event verified against current Key Vault docs. Evidence: https://learn.microsoft.com/en-us/azure/key-vault/secrets/tutorial-rotation

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_l5p7eaTRFg7pnXynwVmSJg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Azure Key Vault: expired or disabled secret versions fail silently or 403 <span>— Vectle</span></a>