Read a secret from Azure Key Vault in a Spring Boot application Always returns default value specified

anil 21 Reputation points
2022-09-13T23:45:25.067+00:00

https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-key-vault

I am trying to follow this link, I have everything setup when I run the spring boot app always returns this default value private String connectionString ="default";

spring.cloud.azure.keyvault.secret.property-source-enabled=true
spring.cloud.azure.keyvault.secret.enabled=true
spring.cloud.azure.keyvault.secret.property-sources[0].credential.client-id=gotthesefromthecommand
spring.cloud.azure.keyvault.secret.property-sources[0].credential.client-secret=gotthesefromthecommand
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=myrul
spring.cloud.azure.keyvault.secret.property-sources[0].profile.tenant-id=gotthesefromthecommand

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,249 questions
0 comments No comments
{count} votes

Accepted answer
  1. Shweta Mathur 29,741 Reputation points Microsoft Employee
    2022-09-15T12:32:54.357+00:00

    Hi @anil ,

    Thanks for reaching out.

    I understand you are trying to read a secret from Azure Key Vault and getting default value.

    There are various ways mentioned in this tutorial to create an app.
    If you tried to create an app with Spring Initializer ,that will show default value as application is not configured with your application details.

    To get the output, go through the create an app without spring Initializer to get the connection string.

    Hope this will help.

    Thanks,
    Shweta

    ---------------------------

    Please remember to "Accept Answer" if answer helped you.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.