Interview Prep/Azure/Quota, Deployment and IaC Errors

`(VaultAlreadyExists)` or `A vault with the same name already exists in deleted state. You need to either recover or purge existing key vault.`

BeginnerTroubleshootingQuota, Deployment and IaC Errors
Answer

Likely causes → You deleted the vault (often via terraform destroy) and soft delete keeps the name reserved.

Diagnose → az keyvault list-deleted --query "[].{name:name, purge:properties.scheduledPurgeDate}" -o table

Fix →

  1. Recover it: az keyvault recover -n kv-shop-dev
  2. Or purge (only if purge protection is off): az keyvault purge -n kv-shop-dev
  3. In Terraform labs, features { key_vault { purge_soft_delete_on_destroy = true } }

Prevent → Unique names per lab run, or the purge feature flag in non-prod.

Azure All Azure questions

More on Quota, Deployment and IaC Errors