Azure / Azure/azure-sdk-for-python

Key Vault secrets versions

Open
#39,790 7 comments 0 reactions 2 assignees Claimed by @cheathamb36 View on GitHub
Client customer-reported feature-request KeyVault needs-team-attention Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

**Is your feature request related to a problem? Please describe.**
I have a setup with frequently changed keyvault secrets. I'm developing some automation service that would implement CAS updates there.

The [SetSecret API](https://learn.microsoft.com/en-us/rest/api/keyvault/secrets/set-secret/set-secret?view=rest-keyvault-secrets-7.4&tabs=HTTP) does not allow me to specify the version I'm going to overwrite, so my fallback plan is to
* fetch version before the update (and save it as `before_update`)
* do the update
* fetch 3 latest versions and compare them to `before_update`
* if I see that `versions[current - 1]` == `before_update` - I'm good
* if I see that `versions[current -2]` == `before_update` - do rollback and report this as a warning
* if I see none of these versions are `before_update` - report this as error (so my monitoring system ring)

However I've got way too many secret versions (as I mentioned before, it's changed quite frequently), and my `list_properties_of_secret_versions` function takes quite a few seconds to execute (which also might cause various race conditions).

**Describe the solution you'd like**
Ideally - CAS updates for secrets version - or at least the way to fetch N latest versions in one (simple and fast) call

**Describe alternatives you've considered**
CAS updates, but couldn't find it's possible with azure keyvault

**Additional context**
Any news regarding getting N latest versions of the secret?
At #35923 @mccoyp mentioned
> I did discuss this with the service team and chronological version sorting unfortunately doesn't appear to be an option at this time. I'll mark this issue as resolved, but we'll be sure to incorporate this feedback into future planning.
Half a year passed, wondering if there might be any plans updates :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.