Skip to content

Latest commit

 

History

History
87 lines (63 loc) · 2.78 KB

File metadata and controls

87 lines (63 loc) · 2.78 KB
title Azure Key Vault libraries for Java
description Overview of the Azure Key Vault libraries for Java
keywords Azure, Java, SDK, API, keyvault, secure, keys, secrets, vault
author rloutlaw
ms.author routlaw
manager douge
ms.date 07/20/2017
ms.topic article
ms.prod azure
ms.technology azure
ms.devlang java
ms.service keyvault

Azure Key Vault libraries for Java

Overview

Safeguard and manage cryptographic keys and secrets used by cloud applications and services with Azure Key Vault.

To get started with Azure Key Vault, see Get started with Azure Key Vault.

Client library

Create, update, and delete keys and secrets in Azure Key Vault with the client libraries.

Add a dependency to your Maven pom.xml file to use the client library in your project.

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-keyvault</artifactId>
    <version>1.0.0</version>
</dependency>

Example

Retrieve a JSON web key from a Key Vault.

KeyVaultClient kvc = new KeyVaultClient(credentials);
KeyBundle returnedKeyBundle = kvc.getKey(vaultUrl, keyName);
JsonWebKey jsonKey = returnedKeyBundle.key();

[!div class="nextstepaction"] Explore the Client APIs

Management API

Use the Azure Key Vault management libraries to create key vaults, authorize applications, and manage permissions.

Add a dependency to your Maven pom.xml file to use the management API in your project.

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-mgmt-keyvault</artifactId>
    <version>1.3.0</version>
</dependency>

Example

Authorize and application running with service principal clientId to list and retrieve secrets from a key vault.

vault1 = vault1.update()
            .defineAccessPolicy()
                .forServicePrincipal(clientId)
                .allowKeyAllPermissions()
                .allowSecretPermissions(SecretPermissions.GET)
                .allowSecretPermissions(SecretPermissions.LIST)
                .attach()
            .apply();

[!div class="nextstepaction"] Explore the Management APIs

Samples

Explore more sample Java code for Azure Key Vault you can use in your apps.