Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c47eeee
update according to issue
FredGao-new Apr 13, 2020
2b3e1f0
update according to issue
FredGao-new Apr 13, 2020
3971c5f
update according to comment
FredGao-new Apr 14, 2020
4430d07
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
255bedf
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
fbf5880
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
4d773e2
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
cacc6a9
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
761b9b1
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
6e08140
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
075c55e
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
c90c2ee
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
c45e6f4
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
3cf136c
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
9ed02cf
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
1fbc9a5
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
712d776
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
3df4032
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
194b680
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
16d32dd
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
7da161b
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
5c442b8
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
5acc225
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
5b34fee
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
FredGao-new Apr 27, 2020
eaab0bb
update according comment
FredGao-new Apr 27, 2020
5cd962a
Made additional changes in favor of readability and consistency in te…
vcolin7 Apr 27, 2020
9b0fcdb
Update sdk/keyvault/azure-security-keyvault-certificates/README.md
vcolin7 May 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions sdk/keyvault/azure-security-keyvault-certificates/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Azure Key Vault Certificate client library for Java
Azure Key Vault allows you to create and store certificates in the Key Vault. Azure Key Vault client supports certificates backed by Rsa keys and Ec keys. It allows you to securely manage, tightly control your certificates.
Azure Key Vault allows you to securely manage and tightly control your certificates. Azure Key Vault Certificate client library supports certificates backed by RSA and EC keys.
Comment thread
FredGao-new marked this conversation as resolved.
Outdated

Multiple certificates, and multiple versions of the same certificate, can be kept in the Key Vault. Cryptographic keys in Key Vault backing the certificates are represented as [JSON Web Key [JWK]](https://tools.ietf.org/html/rfc7517) objects. This library offers operations to create, retrieve, update, delete, purge, backup, restore and list the certificates and its versions.
Multiple certificates, and multiple versions of the same certificate, can be kept in the Key Vault. Cryptographic keys in Key Vault backing the certificates are represented as [JSON Web Key [JWK]](https://tools.ietf.org/html/rfc7517) objects. This library offers operations to create, retrieve, update, delete, purge, backup, restore, and list the certificates and its versions.
Comment thread
FredGao-new marked this conversation as resolved.
Outdated

[Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][azkeyvault_docs] | [Samples][certificates_samples]

Expand Down Expand Up @@ -31,12 +31,12 @@ Maven dependency for Azure Key Client library. Add it to your project's pom file
```

### Authenticate the client
In order to interact with the Key Vault service, you'll need to create an instance of the [CertificateClient](#create-certificate-client) class. You would need a **vault url** and **client secret credentials (client id, client key, tenant id)** to instantiate a client object using the default `AzureCredential` examples shown in this document.
In order to interact with the Key Vault service, you'll need to create an instance of the [CertificateClient](#create-certificate-client) class. You need a **vault url** and **client secret credentials (client id, client secret, tenant id)** to instantiate a client object using the `DefaultAzureCredential` examples shown in this document.
Comment thread
FredGao-new marked this conversation as resolved.
Outdated

The `DefaultAzureCredential` way of authentication by providing client secret credentials is being used in this getting started section but you can find more ways to authenticate with [azure-identity][azure_identity].

#### Create/Get credentials
To create/get client key credentials you can use the [Azure Portal][azure_create_application_in_portal], [Azure CLI][azure_keyvault_cli_full] or [Azure Cloud Shell](https://shell.azure.com/bash)
To create/get client secret credentials you can use the [Azure Portal][azure_create_application_in_portal], [Azure CLI][azure_keyvault_cli_full] or [Azure Cloud Shell](https://shell.azure.com/bash)

Here is [Azure Cloud Shell](https://shell.azure.com/bash) snippet below to
Comment thread
FredGao-new marked this conversation as resolved.
Outdated

Expand All @@ -58,7 +58,7 @@ Here is [Azure Cloud Shell](https://shell.azure.com/bash) snippet below to
}
```

* Use the above returned credentials information to set **AZURE_CLIENT_ID**(appId), **AZURE_CLIENT_SECRET**(password) and **AZURE_TENANT_ID**(tenant) environment variables. The following example shows a way to do this in Bash:
* Use the above returned credentials information to set **AZURE_CLIENT_ID** (appId), **AZURE_CLIENT_SECRET** (password), and **AZURE_TENANT_ID** (tenantId) environment variables. The following example shows a way to do this in Bash:
Comment thread
FredGao-new marked this conversation as resolved.
Outdated

```Bash
export AZURE_CLIENT_ID="generated-app-ID"
Expand All @@ -69,7 +69,7 @@ Here is [Azure Cloud Shell](https://shell.azure.com/bash) snippet below to
* Grant the above mentioned application authorization to perform key operations on the keyvault:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to perform certificate operations?

Comment thread
FredGao-new marked this conversation as resolved.
Outdated

```Bash
az keyvault set-policy --name <your-key-vault-name> --spn $AZURE_CLIENT_ID --certificate-permissions backup delete get list create
az keyvault set-policy --name <your-key-vault-name> --spn $AZURE_CLIENT_ID --certificate-permissions backup delete get list create update
```

> --certificate-permissions:
Expand All @@ -87,6 +87,7 @@ Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and **AZU
```Java
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.security.keyvault.certificates.CertificateClient;
import com.azure.security.keyvault.certificates.CertificateClientBuilder;

CertificateClient client = new CertificateClientBuilder()
.vaultUrl(<your-vault-url>)
Comment thread
FredGao-new marked this conversation as resolved.
Outdated
Expand All @@ -108,7 +109,7 @@ The Certificate client performs the interactions with the Azure Key Vault servic

## Examples
### Sync API
The following sections provide several code snippets covering some of the most common Azure Key Vault Key Service tasks, including:
The following sections provide several code snippets covering some of the most common Azure Key Vault Certificate Service tasks, including:
Comment thread
FredGao-new marked this conversation as resolved.
Outdated
- [Create a Certificate](#create-a-certificate)
- [Retrieve a Certificate](#retrieve-a-certificate)
- [Update an existing Certificate](#update-an-existing-certificate)
Expand All @@ -117,15 +118,19 @@ The following sections provide several code snippets covering some of the most c

### Create a Certificate
Comment thread
FredGao-new marked this conversation as resolved.
Outdated

Comment thread
FredGao-new marked this conversation as resolved.
Outdated
Create a Certificate to be stored in the Azure Key Vault.
- `beginCreateCertificate` creates a new certificate in the key vault. if the certificate with name already exists then a new version of the certificate is created.
Create a certificate to be stored in the Azure Key Vault.
- `beginCreateCertificate` creates a new certificate in the Azure Key Vault. if the certificate with name already exists then a new version of the certificate is created.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

. if --> . If

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all certificate be updated to Certificate?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be the other way around.

Comment thread
FredGao-new marked this conversation as resolved.
Outdated

```Java
import com.azure.core.util.polling.LongRunningOperationStatus;
import com.azure.core.util.polling.SyncPoller;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.security.keyvault.certificates.models.Certificate;
import com.azure.security.keyvault.certificates.models.CertificatePolicy;
import com.azure.security.keyvault.certificates.models.CertificateOperation;
import com.azure.security.keyvault.certificates.CertificateClient;
import com.azure.security.keyvault.certificates.CertificateClientBuilder;
import com.azure.security.keyvault.certificates.models.CertificateOperation;
import com.azure.security.keyvault.certificates.models.CertificatePolicy;
import com.azure.security.keyvault.certificates.models.KeyVaultCertificate;
import com.azure.security.keyvault.certificates.models.KeyVaultCertificateWithPolicy;

CertificateClient certificateClient = new CertificateClientBuilder()
.vaultUrl(<your-vault-url>)
Comment thread
FredGao-new marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -192,7 +197,7 @@ for (CertificateProperties certificateProperties : certificateClient.listPropert
```

### Async API
The following sections provide several code snippets covering some of the most common asynchronous Azure Key Vault Key Service tasks, including:
The following sections provide several code snippets covering some of the most common asynchronous Azure Key Vault Certificate Service tasks, including:
Comment thread
FredGao-new marked this conversation as resolved.
Outdated
- [Create a Certificate Asynchronously](#create-a-certificate-asynchronously)
Comment thread
FredGao-new marked this conversation as resolved.
Outdated
- [Retrieve a Certificate Asynchronously](#retrieve-a-certificate-asynchronously)
Comment thread
FredGao-new marked this conversation as resolved.
Outdated
- [Update an existing Certificate Asynchronously](#update-an-existing-certificate-asynchronously)
Comment thread
FredGao-new marked this conversation as resolved.
Outdated
Expand All @@ -203,15 +208,13 @@ The following sections provide several code snippets covering some of the most c

### Create a Certificate Asynchronously
Comment thread
FredGao-new marked this conversation as resolved.
Outdated

Comment thread
FredGao-new marked this conversation as resolved.
Create a Certificate to be stored in the Azure Key Vault.
- `beginCreateCertificate` creates a new certificate in the key vault. if the certificate with name already exists then a new version of the certificate is created.
Create a certificate to be stored in the Azure Key Vault.
- `beginCreateCertificate` creates a new certificate in the Azure Key Vault. if the certificate with name already exists then a new version of the certificate is created.
Comment thread
FredGao-new marked this conversation as resolved.
Outdated

```Java
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.security.keyvault.certificates.models.Certificate;
import com.azure.security.keyvault.certificates.models.CertificatePolicy;
import com.azure.security.keyvault.certificates.models.CertificateOperation;
import com.azure.security.keyvault.certificates.CertificateAsyncClient;
import com.azure.security.keyvault.certificates.models.CertificatePolicy;

//Creates a certificate using the default policy and polls on its progress.
certificateAsyncClient.beginCreateCertificate("certificateName", CertificatePolicy.getDefault())
Comment thread
FredGao-new marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -271,7 +274,7 @@ List the certificates in the key vault by calling `listPropertiesOfCertificates`
```Java
// The List Certificates operation returns certificates without their full properties, so for each certificate returned we call `getCertificate` to get all its attributes excluding the policy.
certificateAsyncClient.listPropertiesOfCertificates()
.subscribe(certificateProperties -> certificateAsyncClient.getCertificate(certificateProperties.getName(),
.subscribe(certificateProperties -> certificateAsyncClient.getCertificateVersion(certificateProperties.getName(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line update to Key Vault.

certificateProperties.getVersion());
.subscribe(certificateResponse -> System.out.printf("Received certificate with name %s and key id %s",
Comment thread
FredGao-new marked this conversation as resolved.
Outdated
certificateResponse.getName(), certificateResponse.getKeyId())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private CertificateClient getCertificateClient() {
/**
* Method to insert code snippets for {@link CertificateClient#getCertificatePolicy(String)}
*/
public void getCertiificatePolicyCodeSnippets() {
public void getCertificatePolicyCodeSnippets() {
CertificateClient certificateClient = getCertificateClient();
// BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificatePolicy#string
CertificatePolicy policy = certificateClient.getCertificatePolicy("certificateName");
Expand Down