azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

Azure key vault property source force refresh

Open maciejbak85 opened this issue 4 years ago • 4 comments

I am using spring boot with azure's keyvault

		<dependency>
			<groupId>com.azure.spring</groupId>
			<artifactId>azure-spring-boot-starter-keyvault-secrets</artifactId>
		</dependency>

but there is a problem, when I want to update secret. How to force for example via rest api lets say, refresh of this value ?

@Value("${x-value}") private val xValue: String = "0"

thanks!

maciejbak85 avatar Mar 17 '22 16:03 maciejbak85

Hi, @maciejbak85 .

Thanks for reaching out. Now azure-spring-boot-starter-keyvault-secrets does not have the feature of update manually. We will consider whether we need to provide this feature, and how to provide this feature.

Now you can use spring.cloud.azure.keyvault.secret.property-sources[].refresh-interval to set auto refresh interval. The default value is 30 minutes.

Reference: https://microsoft.github.io/spring-cloud-azure/4.0.0-beta.3/4.0.0-beta.3/reference/html/index.html#configuration-4

chenrujun avatar Mar 18 '22 00:03 chenrujun

FYI, the Spring Cloud Azure 4.0 has been GAed. https://microsoft.github.io/spring-cloud-azure/current/reference/html/index.html

saragluna avatar Apr 01 '22 12:04 saragluna

@chenrujun I am facing the same issue in the latest 4.3.0 version as well. I have setup the refresh interval for azure keyvault and I have observed that the latest secret versions are fetched as per the Refresh interval. But the issue is with the environment, While I am trying to access the environment.getProperty(), I still observe the old value. It is not refreshed in the environment somehow.

I believe the issue is with the usage of CachingDelegateEncryptablePropertySource in the environment property for azure keyvault secrets. I believe the cache used by the propertySource is not refreshed.

sy185109 avatar Jul 20 '22 14:07 sy185109

@sy185109

When you execute environment.getProperty("text"), you can add a breakpoint here: https://github.com/Azure/azure-sdk-for-java/blob/spring-cloud-azure-autoconfigure_4.3.0/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/keyvault/environment/KeyVaultOperation.java#L108-L110

Check whether the value is updated in KeyVaultOperation.

chenrujun avatar Aug 10 '22 09:08 chenrujun

@sy185109 are u suing this https://github.com/ulisesbocchio/jasypt-spring-boot?

stliu avatar Jan 03 '23 06:01 stliu

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

ghost avatar Jan 11 '23 02:01 ghost

@sy185109 are u suing this https://github.com/ulisesbocchio/jasypt-spring-boot?

Yes, I am using this library.

sy185109 avatar Feb 14 '24 03:02 sy185109

Hi @maciejbak85, we deeply appreciate your input into this project. Regrettably, this issue has remained inactive for over 2 years, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support.

github-actions[bot] avatar Mar 18 '24 18:03 github-actions[bot]