Azure-Samples/azure-spring-boot-samples

[BUG] all properties for app configuration under stores[] appear to be ignored in bootstrap.yaml

vaculajm opened this issue · 3 comments

Describe the bug
Using bootstrap.yaml to configure app configuration, the properties under stores[] are populated are being ignored. The bootstrap.yaml values that I have are pasted below, The endpoint seems to work only because it is the same as the environment variable used by default. Also, auto-complete in the yaml editor doesn't show any of the properties under stores[] :
spring: cloud: azure: appconfiguration: enabled: true credential: managed-identity-enabled: true stores: - endpoint: ${APP_CONFIGURATION_ENDPOINT} selects: - key-filter: /myfilter/

Exception or Stack Trace
In the example above, the filter is ignored and only expects properties prefixed with "/application/", and if the $APP_CONFIGURATION_ENDPOINT env variable is renamed to something else, i.e. $MY_APP_CONFIG_ENDPOINT, it will also ignore that property.

To Reproduce
Create a new spring boot application bootstrapping app configuration properties using a yaml file, create an environment variable with the endpoint of an app configuration endpoint, enable managed identity using CLI to login into a subscription containing the app config instance, create new app config k/v pair with a different filter than "/application/", create a pojo that expects to read values from that filter. Changing the filter to be "/application/" and running again will work.

Setup (please complete the following information):

  • OS: Windows 11
  • IDE: Intellij
  • Sample Path:
  • Library/Libraries: com.azure.spring:spring-cloud-azure-dependencies:4.3.0, com.azure.spring:azure-spring-cloud-starter-appconfiguration-config:2.7.0
  • Java version: 11
  • App Server/Environment: Tomcat
  • Frameworks: Spring Boot

Hi @mrm9084 , please take a look.

@vaculajm can you verify that this is what you have? The format seems to be messed up in the original comment.

spring:
  cloud:
    azure:
      appconfiguration:
        enabled: true
        credential:
          managed-identity-enabled: true
        stores:
          - 
            endpoint: ${APP_CONFIGURATION_ENDPOINT}
            selects:
              - 
                key-filter: /myfilter/

Second, wed don't look at environment variables for endpoints so it is coming from your config.
Third, I think it is reading it fine, you are just missing the wildcard for the key-filter. It should be key-filter: /myfilter/*
Fourth, where did you get these properties managed-identity-enabled isn't a value in the library.
https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/appconfiguration/azure-spring-cloud-starter-appconfiguration-config#supported-properties

Sorry for the delayed response as I was traveling. I found the issue in a dependency that had an old version (1.2) of an azure app config dependency that was superseding the bootstrap.yml of this application hence why the endpoint was successfully being reached. However, in your response above, putting the asterisk in the filter will cause the a failure on startup, and the managed-identity-enabled property was something that IntelliJ made available on auto-complete that we tried when debugging.