possible way to Get Secret ID using application id(Client id),Key Vault URI, tenent id and display name

Aheen Arputharaj 0 Reputation points
2023-12-28T10:59:44.87+00:00

A third party provided me with the api to obtain the access token. We need to pass the client id and client secret from our end. They directly shared the client id, however they asked us to retrieve the secret id from the Azure key vault. They have shared the Vault uri, application id (client id), tenant id, and display name. Using these details, how can I get the secret id? Java code is more preferable.

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,448 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alfredo Revilla - Upwork Top Talent | IAM SWE SWA 27,526 Reputation points Moderator
    2023-12-28T18:04:23.82+00:00

    Hello @Aheen Arputharaj , in order to obtain an Azure KeyVault secret using Java you can use sample code available at Azure Key Vault Secret Samples client library for Java. Eg:

    TokenCredential clientSecretCredential = new ClientSecretCredentialBuilder().tenantId("string").clientId("string").clientSecret("string").build();
    
    SecretAsyncClient secretAsyncClient = new SecretClientBuilder()
                .vaultUrl("string")
                .credential(tokenCredential)
                .buildAsyncClient();
    
    secretAsyncClient.getSecret("string").subscribe(secretResponse -> /*do something*/ );
    

    Authenticating samples can be found at JavaDocCodeSnippets.java.

    Let us know if you need additional assistance. If the answer was helpful, please accept it and rate it so that others facing a similar issue can easily find a solution.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.