Getting secret from Key Vault of previous version

Data_Analytics1
Contributor III

Hi,

I have added secrets in Azure Key Vault and also updated it few times. I need to access current as well as previous version secret in a data pipeline. 

dbutils.secrete.get(KeyName, SecretScopeName)

This gives me the current version of secret.

How can I access previous version secret using dbutils command?

Hi @Retired_mod ,

I tried executing following code:

SecreteScopeName = 'SecretScope'
KeyName = 'Key123'
version = '123456789abcdefghijklmn'
val = dbutils.secrets.get(SecreteScopeName, key=KeyName + version)

 It is giving me the below error:

IllegalArgumentException: Secret does not exist with scope: SecretScope and key: Key123123456789abcdefghijklmn
 
Looks like after appending the version to secret name, dbutils command is looking for this new key which is combination of name and version.

johnb1
Contributor

Hi @Retired_mod@Data_Analytics1 

Has a solution this problem been found in the meantime?

I need to access a secret with a SPECIFIC VERSION from Azure Key Vault via Databricks Secret Scope. Hence while retrieving the secret I need to pass BOTH AKV secret name AND AKV secret version. I want to use a function such as 

dbutils.secrets.get(scope="my-scope", key="my-key")

Concatenating name and version and passing it into the function does not work.

Best,

John.