skip to Main Content

There was some dependency incompatibility occurring because we were using an older version of azure keyvault (azure-keyvault-secrets-spring-boot-starter 2.2.1) but it got updated and we are upgrading it to azure-spring-boot-starter-keyvault-secrets 4.0.0. Now the keyvault isn’t being connected maybe because the application.yml keyvault config is in the wrong syntax.

This is what was there before when it was working with the 2.2.1 version:

azure:
  keyvault:
    uri: ${uri}
    client-id: ${clientId}
    client-key: ${clientKey}
    token-acquire-timeout-seconds: 120

This is how we are trying now but it isn’t connecting.

spring:
  cloud:
    azure:
      keyvault:
        secret:
          property-sources:
            uri: ${uri}
            client-id: ${clientId}
            client-key: ${clientKey}
            token-acquire-timeout-seconds: 120

What is the correct syntax for this azure keyvault version configuration??

2

Answers


  1. It should most probably look like this:

    spring:
      cloud:
        azure:
          keyvault:
            secret:
              property-sources[0]:
                endpoint: ${uri}
                credential:
                  client-id: ${clientId}
                  client-secret: ${clientKey}
    

    From the migration guide from 3.x.x to 4.x (direct link):

    Legacy properties Modern properties
    azure.keyvault.case-sensitive-keys spring.cloud.azure.keyvault.secret.property-sources[n].case-sensitive
    azure.keyvault.certificate-password spring.cloud.azure.keyvault.secret.property-sources[n].credential.client-certificate-password
    azure.keyvault.certificate-path spring.cloud.azure.keyvault.secret.property-sources[n].credential.client-certificate-path
    azure.keyvault.client-id spring.cloud.azure.keyvault.secret.property-sources[n].credential.client-id
    azure.keyvault.client-key spring.cloud.azure.keyvault.secret.property-sources[n].credential.client-secret
    azure.keyvault.enabled spring.cloud.azure.keyvault.secret.enabled and spring.cloud.azure.keyvault.secret.property-source-enabled
    azure.keyvault.refresh-interval spring.cloud.azure.keyvault.secret.property-sources[n].refresh-interval
    azure.keyvault.secret-keys spring.cloud.azure.keyvault.secret.property-sources[n].secret-keys
    azure.keyvault.tenant-id spring.cloud.azure.keyvault.secret.property-sources[n].profile.tenant-id
    azure.keyvault.uri spring.cloud.azure.keyvault.secret.property-sources[n].endpoint
    Login or Signup to reply.
  2. not working for me and getting below error..
    Caused by: com.azure.identity.CredentialUnavailableException: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/java/identity/environmentcredential/troubleshoot

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search