0
votes

In an Azure Function, will a Key Vault reference works without the version number in the "SecretUri"

@Microsoft.KeyVault(SecretUri=https://MYKEYVAULT.vault.azure.net/secrets/secretkey/)

I need to connect to a Key Vault secret without any version, so that while rotating secrets, there is no need to update the version in the application configuration.

2

2 Answers

0
votes

The version is unnecessary. If you don't specify it, you always get the latest. Same for keys and certificates.

I also recommend taking a look at our newer Azure SDK packages that start with azure.* instead of microsoft.azure.*. They will be our primary vehicle for new features and are faster with fewer allocations, with better logging, easier authentication, and more.

We also have configuration extensions available to work with Azure Functions, App Services (or just web apps in general), or wherever you need them.

2
votes

Yeah, we can have reference to the key vault from azure function configuration using the following format:

@Microsoft.KeyVault(SecretUri=https://KEY_VAULT_NAME.vault.azure.net/secrets/SECRET_NAME_IN_KEY_VAULT/)

If this format is used, the latest version of the secret will be used.

Note: The backward slash (/) after the secret name in compulsory. Reference will not work if the backward slash is omitted.