[QUERY] Correctly configure spring-cloud-azure-starter-keyvault-secrets for client ID/secret authentication
See original GitHub issueQuery/Question I am having an issue configuring the spring-cloud-azure-starter-keyvault-secrets to use client ID/secret authentication to the key vault. Following the instructions at https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-key-vault#add-key-vault-configuration-to-the-app, I am setting the following properties in my application.yml file (with placeholders for this submission):
spring:
cloud:
azure:
keyvault:
secret:
property-sources:
- endpoint: ${keyvaultUri}
profile:
tenant-id: ${tenantId}
credential:
client-id: ${clientId}
client-secret: ${clientSecret}
I am getting the following error:
com.azure.core.exception.ClientAuthenticationException: The current credential is not configured to acquire tokens for tenant ${tenantId}. To enable acquiring tokens for this tenant add it to the AdditionallyAllowedTenants on the credential options, or add "*" to AdditionallyAllowedTenants to allow acquiring tokens for any tenant. See the troubleshooting guide for more information. https://aka.ms/azsdk/java/identity/multitenant/troubleshoot
However, the tenant ID matches the one that the service principal was created under. Additionally, I’m not building the DefaultAzureCredentials and letting the Spring Boot autoconfiguration do it. Looking for guidance on either how to manually wire the Azure Credentials so I can add that AdditionallyAllowedTenants block, or what I should be doing differently in the plugin configuration in order to make this work.
Why is this not a Bug or a feature Request? I assume that I am doing something wrong or just missing something, so I do not believe this is a bug in the code.
Setup (please complete the following information if applicable):
- OS: macOS 13 (also appears on AKS in an openjdk:11-jre-slim container)
- IDE: IntelliJ IDEA
- Library/Libraries: com.azure.spring:spring-cloud-azure-starter-keyvault-secrets:4.4.1, org.springframework.boot:spring-boot-starter-parent:2.7.5
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
- Query Added
- Setup information Added
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:14 (8 by maintainers)
Top GitHub Comments
/cc @vcolin7 as fyi
@chenrujun you have it correct. I will close out the issue, thank you for the assistance!