Adam
Adam

Reputation: 15

How to update Key Vault secret value without changing secret identifier?

Is there a way to change a Key Vault secret value without changing secret identifier ? I tried new version button in azure portal but the secret identifier changed .

thanks , Adam.

Upvotes: 1

Views: 4925

Answers (2)

ping
ping

Reputation: 811

Use the URL whitout the key:

https://kv-we-retrieve-kv-secret.vault.azure.net/secrets/MySecretValue/

Using the Secret Identifier like this, will reference the latest secret value.

Reference: https://blog.eldert.net/reference-key-vault-secret-latest-version/

[...] However, often we will just want to reference the latest version, so we stay up to date even when the secret has been changed, for example because it is a rotating password.

It turns out, this is very easy, without the need to update the version number in all our applications whenever a new version is created. This is done by just omitting the version number from our link! So the will instead look like https://kv-we-retrieve-kv-secret.vault.azure.net/secrets/MySecretValue/.

Important to notice is the trailing slash ( / ), which needs to be included, otherwise you will just get a 404 error.[...]

Upvotes: 1

McGuireV10
McGuireV10

Reputation: 9946

No, there is no way to control the identifier via the REST API, the .NET libraries, or the Portal, nor can the value of an existing secret version be changed. A new version always generates a new identifier. The same applies to Key Vault keys.

Upvotes: 2

Related Questions