pulumi-azure-native: Deleting a key vault secret does not purge it, therefore it's not available for reuse.

When a key vault secret is created using user-provided name and then deleted, the secret is not purged, meaning it cannot be reused until either manually purged or expired by the retention window (min 7 days).

Example resource

const credentialsSecret = new azure.keyvault.Secret("credentials", {
        keyVaultId: conf.infraConfig.keyVaultId,
        value: credentials.password,
        name: `credentials`,
    }, { deleteBeforeReplace: true });

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 13
  • Comments: 16 (5 by maintainers)

Most upvoted comments

How about simply restoring the secret if a deleted (but not yet purged) secret exists?

The secret provider should

  • create the secret
  • if that fails, try to restore a deleted secret with the same name and set value

or simply purge it if the creation fails and then recreate it.

@praneetloke in Azure classic, if you have a key vault that isn’t auto-named, delete it and attempt to re-create it, the provider will attempt to recover it. We don’t do this in Azure native.

Currently, in Azure, you can disable soft-delete, which means that when you delete the resource, it’s gone for good, and if you don’t use auto-naming then you can recreate the resource over and over again. However, when MS/Azure enables soft-delete permanently, it means that a new key vault created with the same name as one that has been soft-deleted (i.e. it’s in a recycle bin somewhere) will fail.

I has same issue, it resolved for me by setting enableSoftDelete:false