question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUERY] Correctly configure spring-cloud-azure-starter-keyvault-secrets for client ID/secret authentication

See original GitHub issue

Query/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:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
joshfreecommented, Nov 8, 2022

/cc @vcolin7 as fyi

0reactions
zpdeeringcommented, Nov 14, 2022

@chenrujun you have it correct. I will close out the issue, thank you for the assistance!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use Client Credentials Flow with Spring Security
You will create a simple resource server that will be secured using Okta as an OAuth 2.0 and OpenID Connect (OIDC) provider. After...
Read more >
Call Your API Using the Client Credentials Flow - Auth0
Following successful authentication, the calling application will have access to an Access Token , which can be used to call your protected APIs....
Read more >
The Client ID and Secret - OAuth 2.0 Simplified
Client Secret. The client_secret is a secret known only to the application and the authorization server. It is essential the application's own ...
Read more >
Quick start guide: Make an authenticated API call
Overview; Prerequisites; Step 1: Create the endpoint URL; Step 2: Set up a client application; Step 3: Configure authentication ...
Read more >
Server Administration Guide - Keycloak
Features; Enable X.509 Client Certificate User Authentication; Adding X.509 ... The query will bring up all users that match your criteria.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found