Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Query] Issue with running spring boot application on azure spring apps with key vault configuration. Using Service principal auth. #39916

Closed
2 tasks
kirankumar994 opened this issue Apr 25, 2024 · 3 comments
Assignees
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@kirankumar994
Copy link

kirankumar994 commented Apr 25, 2024

Screenshot from 2024-04-26 10-52-32
I have a spring boot application, using key vault to store my mongodb credentials. I am using service principal authentication to connect with azure key vault. The application is currently running on local env after log in with az login service principal. But, when I am trying to deploy it on azure spring cloud, I am getting the below exception

I am using the below dependency

com.azure.spring
spring-cloud-azure-starter-keyvault
5.11.0

java.lang.IllegalStateException: Failed to configure KeyVault property source

`
@value("${spring.cloud.azure.keyvault.secret.property-sources[0].endpoint}")
private String keyVaultEndpoint;

@Value("${azure.keyvault.client-id}")
private String clientId;

@Value("${azure.keyvault.client-key}")
private String clientSecret;

@Value("${azure.keyvault.tenant-id}")
private String tenantId;

@Bean
public SecretClient createSecretClient() {

    ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
            .clientId(clientId)
            .clientSecret(clientSecret)
            .tenantId(tenantId)
            .build();

    // Azure SDK client builders accept the credential as a parameter.
    return new SecretClientBuilder()
            .vaultUrl(keyVaultEndpoint)
            .credential(clientSecretCredential)
            .buildClient();
}`

This is the Bean I kept in my mongodb config class. I am using the same service principal to deploy from local. And, it is getting deployed as well, but the application failed to start due to above exception. I tried with managed identity as well but no luck. I wanted to use service principal to connect with azure key vault as well. Please help me where am I doing wrong. 

Why is this not a Bug or a feature Request?
A clear explanation of why is this not a bug or a feature request?

Setup (please complete the following information if applicable):

  • OS: [e.g. iOS]
  • IDE: [e.g. IntelliJ]
  • Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)]

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
@github-actions github-actions bot added azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 25, 2024
Copy link

Copy link

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@kirankumar994
Copy link
Author

Hi all,
I have been waiting for the response here. Thank you so much in advance.

@kirankumar994 kirankumar994 closed this as not planned Won't fix, can't repro, duplicate, stale May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
Status: Done
Development

No branches or pull requests

2 participants