Skip to content

What's the best way to handle key vault creation in Bicep with soft deletion and purge protection? #10656

Discussion options

You must be logged in to vote

I don't think there is a good "declarative" approach here.

I assume if it's set to recover and it's new, then it fails? Hopefully you are not using access policies anyway, RBAC is a better model in most circumstances.

The fallback would be to add a restore function in a deploymentScript, which skips action if the vault isn't soft deleted or restores if it was.

Then run that Module, before you're normal keyvault Module.

If this is for a lab, I would just disable soft delete all together.

What scenario do you find yourself in need of this? How often are people deleting vaults? Perhaps consider a delete lock as an alternative.

Or let the deployment fail, then run a manual restore command, th…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@BartDecker
Comment options

@hallgeir-osterbo-visma
Comment options

@brwilkinson
Comment options

Answer selected by hallgeir-osterbo-visma
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants