Skip to content

[BUG] Spring cloud, appcofiguration credentials not considered #47238

@Backfighter

Description

@Backfighter

Describe the bug
The credential options for appconfiguration are not considered on boot.

Exception or Stack Trace
This is a logical bug that doesn't have a stack trace.

To Reproduce
Steps to reproduce the behavior:
Create a basic spring project with application.yaml:

spring:
  cloud:
      appconfiguration:
        enabled: true
        credential:
          # Sample credentials they don't belong to any actual app registration
          client-id: 8d7d321f-511a-4b4a-9665-762aca382494
          client-secret: joiwfj309u20u430gj20g29gu03f0sd9uf9
        profile:
          # Sample tenant that doesn't exist
          tenant-id: 7dd454aa-4f5d-4413-bfa1-372e4037a4e1
        stores:
          - endpoint: "https://${azure.app.config}.azconfig.io"
  config:
    import:
      - azureAppConfiguration

Add dependencies:

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2025.0.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.azure.spring</groupId>
                <artifactId>spring-cloud-azure-dependencies</artifactId>
                <version>6.0.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.azure.spring</groupId>
            <artifactId>spring-cloud-azure-appconfiguration-config</artifactId>
        </dependency>
    </dependencies>

On boot the credentials provided are not considered when creating the ConfigurationClientBuilderFactory in AzureAppConfigurationBootstrapRegistrar.
This happens because all fields of the global configuration are null and override the ones in the local config (AzureGlobalPropertiesUtils#loadProperties uses AzurePropertiesUtils#copyAzureCommonProperties which uses BeanUtils#copyProperties, copying all null values from the global config to the local one).

Expected behavior
I expect the appconfiguration properties to be used by the configuration client. However, they are not.

Setup (please complete the following information):

  • OS: iOS
  • IDE: IntelliJ
  • Library/Libraries: com.azure.spring:spring-cloud-azure-appconfiguration-config:6.0.0
  • Java version: 21
  • App Server/Environment: Tomcat
  • Frameworks: Spring Boot

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

Metadata

Metadata

Assignees

Labels

azure-springAll azure-spring related issuesbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions