I have set up a Spring Cloud Azure application. I use both secrets and keys in my Azure Keyvault. I started with integrating secrets and followed https://spring.io/projects/spring-cloud-azure, which allows me to autowire a Secret Client with only the following in my application configuration properties yaml
spring:
cloud:
azure:
keyvault:
secret:
endpoint:
I got it set up and working pretty smoothly.
Then I moved on to KeyClient, thinking that I could reuse some of this setup, but I couldn't find something similar even in the source code
Does that mean I still have to include all the other config props like client id, client secret, etc? it seems that I will end up having to implement everything under "Without Spring Cloud Azure" AND everything under "With Spring Cloud Azure", when I could just do the former which is necessary for KeyClient anyway. Please correct me if I'm wrong. Thanks!
I tried the following Spring Boot code using KeyClient to retrieve the key from the Azure Key Vault.
Code :
KeyVaultKeyServices :
KeyController :
application.yml :
I granted the necessary permissions to read the key from the Azure Key Vault as follows:
Output :
The Spring Boot project ran successfully, as shown below:
I retrieved the key from the Azure Key Vault in the browser, as below.