adeveloper
adeveloper

Reputation: 80

KeyVaultClient and KeyVaultCredentials not present in new SDKs

We were using KeyVaultClient and KeyVaultCredentials classes as provided in the SDK - com.microsoft.azure azure-keyvault

Recently got a warning that this library is deprecated and is divided into 3 libraries - azure-keyvault-security-certificates, azure-keyvault-security-secrets and azure-keyvault-security-keys but I could not find these classes in any of the libraries. Am I still supposed to use azure-keyvault for these classes?

Upvotes: 1

Views: 442

Answers (1)

vcolin7
vcolin7

Reputation: 101

Depending on what functionality of Key Vault you want to use, instead of a KeyVaultClient you would use a CertificateClient, KeyClient or SecretClient.

For example, you can instantiate a simple client the following way:

KeyClient keyClient = new KeyClientBuilder()
    .vaultUrl("<your-key-vault-url>")
    .credential(new DefaultAzureCredentialBuilder().build())
    .buildClient();

There are many more methods you can use in a client builder to customize the resulting client.

As for a replacement for KeyVaultCredentials, client builders allow you to authenticate the client to be created via the credential() method, so you can choose the way that best fits your solution. For more information on the available credential types and their diffecences you can check the Azure Identity README.

Upvotes: 1

Related Questions