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,313 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In this microsoft learn article, I can only see the support to 'certificate' and 'secret'. For example, we can easily auto configured the SecretClient
with the properties defined in application.yaml but not the KeyClient
where we use in Azure SDK for Java for key encryption / wrapping key purposes.
The only way I can achieve key encryption with KeyClient
is below but not robust at all
package com.hub4.springboot.config;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.security.keyvault.keys.KeyClient;
import com.azure.security.keyvault.keys.KeyClientBuilder;
import com.azure.spring.cloud.service.implementation.keyvault.KeyVaultProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AzureKeyVaultConf {
// I have defined necessary parameters in application.yaml
@Autowired
private KeyVaultProperties keyVaultProperties;
@Bean
public KeyClient keyClient() {
return new KeyClientBuilder()
.vaultUrl(keyVaultProperties.getEndpoint())
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
}
}
Any better approach / alternative?