Skip to content

Commit

Permalink
Update Key Vault docs with late PR feedback (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths committed Nov 9, 2019
1 parent 1c4b1dc commit 0be76a7
Show file tree
Hide file tree
Showing 30 changed files with 86 additions and 76 deletions.
7 changes: 4 additions & 3 deletions sdk/keyvault/Azure.Security.KeyVault.Certificates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ az keyvault create --resource-group <your-resource-group-name> --name <your-key-
In order to interact with the Key Vault service, you'll need to create an instance of the [CertificateClient][certificate_client_class] class. You would need a **vault url**, which you may see as "DNS Name" in the portal,
and **client secret credentials (client id, client secret, tenant id)** to instantiate a client object.

Client secret credential authentication is being used in this getting started section but you can find more ways to authenticate with [Azure identity][azure_identity]. To use the `DefaultAzureCredential` provider shown below,
Client secret credential authentication is being used in this getting started section but you can find more ways to authenticate with [Azure identity][azure_identity]. To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below,
or other credential providers provided with the Azure SDK, you should install the Azure.Identity package:

```PowerShell
Expand Down Expand Up @@ -116,7 +116,7 @@ The following section provides several code snippets using the [above created](#
### Create a certificate
`StartCreateCertificate` creates a Certificate to be stored in the Azure Key Vault. If a certificate with
the same name already exists, then a new version of the certificate is created.
When creating the certificate the user can specify the policy which controls the certificate lifetime. If no policy is specified the default policy will be used. The `StartCreateCertificate` operation returns a `CertificateOperation`. The following example creates a self signed certificate with the default policy.
When creating the certificate the user can specify the policy which controls the certificate lifetime. If no policy is specified the default policy will be used. The `StartCreateCertificate` operation returns a `CertificateOperation`. The following example creates a self-signed certificate with the default policy.

```C# Snippet:CreateCertificate
// Create a certificate. This starts a long running operation to create and sign the certificate.
Expand All @@ -134,7 +134,7 @@ while (!operation.HasCompleted)
KeyVaultCertificateWithPolicy certificate = operation.Value;
```

> NOTE: Depending on the certificate issuer and validation methods, certificate creation and signing can take an indeterministic amount of time. Users should only wait on certificate operations when the operation can be reasonably completed in the scope of the application, such as with self signed certificates or issuers with well known response times.
> NOTE: Depending on the certificate issuer and validation methods, certificate creation and signing can take an indeterminate amount of time. Users should only wait on certificate operations when the operation can be reasonably completed in the scope of the application, such as with self-signed certificates or issuers with well known response times.
### Retrieve a certificate
`GetCertificateWithPolicy` retrieves the latest version of a certificate stored in the Key Vault along with its `CertificatePolicy`.
Expand Down Expand Up @@ -324,5 +324,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[get_cetificates_async]: samples/Sample2_GetCertificatesAsync.cs
[get_cetificates_sync]: samples/Sample2_GetCertificates.cs
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[DefaultAzureCredential]: ../../identity/Azure.Identity/README.md

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Fkeyvault%2FAzure.Security.KeyVault.Certificates%2FREADME.png)
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Setting, getting, updating, and deleting certificates

This sample demonstrates how to set, get, update and delete a certificate.
This sample demonstrates how to set, get, update, and delete a certificate.
To get started, you'll need a URI to an Azure Key Vault. See the [README](../README.md) for links and instructions.

## Creating a CertificateClient

To create a new `CertificateClient` to create, get, update, or delete certificates, you need the endpoint to a Key Vault and credentials.
You can use the `DefaultAzureCredential` to try a number of common authentication methods optimized for both running as a service and development.
You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development.

In the sample below, you can set `keyVaultUrl` based on an environment variable, configuration setting, or any way that works for your application.

Expand All @@ -33,7 +33,7 @@ while (!certOp.HasCompleted)

## Getting a certificate with policy

At some time later we could get the created certificate along with it's policy from the Key Vault.
We can now get the created certificate along with its policy from the Key Vault.

```C# Snippet:CertificatesSample1GetCertificateWithPolicy
KeyVaultCertificateWithPolicy certificate = client.GetCertificate(certName);
Expand All @@ -56,7 +56,7 @@ Debug.WriteLine($"Certificate enabled set to '{updatedCert.Properties.Enabled}'"
## Creating a certificate with a new version

We need to create a new version of the certificate that applications can use to replace the compromised certificate.
Creating a certificate with the same name and policy as the compromised certificate will create another version of the certificate with similar properties to the original certificate.
We can create a new certificate with the same name and policy as the compromised certificate will create another version of the certificate with similar properties to the original certificate.

```C# Snippet:CertificatesSample1CreateCertificateWithNewVersion
CertificateOperation newCertOp = client.StartCreateCertificate(certificate.Name, certificate.Policy);
Expand Down Expand Up @@ -92,8 +92,4 @@ To see the full example source, see:
* [Synchronous Sample1_HelloWorld.cs](../tests/samples/Sample1_HelloWorld.cs)
* [ASynchronous Sample1_HelloWorldAsync.cs](../tests/samples/Sample1_HelloWorldAsync.cs)






[DefaultAzureCredential]: ../../../identity/Azure.Identity/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Listing certificates, certificate versions and deleted certificates
# Listing certificates, certificate versions, and deleted certificates

This sample demonstrates how to list certificates and versions of given certificates, and list deleted certificates in a soft delete-enabled key vault.
This sample demonstrates how to list certificates, versions of given certificates, and list deleted certificates in a soft delete-enabled key vault.
To get started, you'll need a URI to an Azure Key Vault. See the [README](../README.md) for links and instructions.

## Creating a CertificateClient

To create a new `CertificateClient` to create, get, update, or delete certificates, you need the endpoint to a Key Vault and credentials.
You can use the `DefaultAzureCredential` to try a number of common authentication methods optimized for both running as a service and development.
You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development.

In the sample below, you can set `keyVaultUrl` based on an environment variable, configuration setting, or any way that works for your application.

Expand Down Expand Up @@ -113,3 +113,5 @@ To see the full example source, see:

* [Synchronous Sample2_GetCertificates.cs](../tests/samples/Sample2_GetCertificates.cs)
* [Asynchronous Sample2_GetCertificatesAsync.cs](../tests/samples/Sample2_GetCertificatesAsync.cs)

[DefaultAzureCredential]: ../../../identity/Azure.Identity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Azure.Security.KeyVault.Certificates
{
/// <summary>
/// The CertificateClient provides synchronous and asynchronous methods to manage <see cref="KeyVaultCertificate"/>s in Azure Key Vault. The client
/// supports creating, retrieving, updating, deleting, purging, backing up, restoring and listing the <see cref="KeyVaultCertificate"/>, along with managing
/// supports creating, retrieving, updating, deleting, purging, backing up, restoring, and listing the <see cref="KeyVaultCertificate"/>, along with managing
/// certificate <see cref="CertificateIssuer"/>s and <see cref="CertificateContact"/>s. The client also supports listing <see cref="DeletedCertificate"/> for a soft-delete
/// enabled key vault.
/// </summary>
Expand Down Expand Up @@ -141,7 +141,7 @@ public virtual async Task<CertificateOperation> StartCreateCertificateAsync(stri
}

/// <summary>
/// Returns the latest version of the <see cref="KeyVaultCertificate"/> along with it's <see cref="CertificatePolicy"/>. This operation requires the certificates/get permission.
/// Returns the latest version of the <see cref="KeyVaultCertificate"/> along with its <see cref="CertificatePolicy"/>. This operation requires the certificates/get permission.
/// </summary>
/// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to retrieve</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
Expand All @@ -166,7 +166,7 @@ public virtual Response<KeyVaultCertificateWithPolicy> GetCertificate(string cer
}

/// <summary>
/// Returns the latest version of the <see cref="KeyVaultCertificate"/> along with it's <see cref="CertificatePolicy"/>. This operation requires the certificates/get permission.
/// Returns the latest version of the <see cref="KeyVaultCertificate"/> along with its <see cref="CertificatePolicy"/>. This operation requires the certificates/get permission.
/// </summary>
/// <param name="certificateName">The name of the <see cref="KeyVaultCertificate"/> to retrieve</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ImportCertificateOptions : IJsonSerializable
/// </summary>
/// <param name="name">A name for the imported certificate.</param>
/// <param name="value">The PFX or PEM formatted value of the certificate containing both the x509 certificates and the private key.</param>
/// <param name="policy">The policy which governs the lifecycle of the imported certificate and it's properties when it is rotated.</param>
/// <param name="policy">The policy which governs the lifecycle of the imported certificate and its properties when it is rotated.</param>
/// <exception cref="ArgumentException"><paramref name="name"/> is empty.</exception>
/// <exception cref="ArgumentNullException"><paramref name="name"/>, <paramref name="policy"/>, or <paramref name="value"/> is null.</exception>
public ImportCertificateOptions(string name, byte[] value, CertificatePolicy policy)
Expand All @@ -53,7 +53,7 @@ public ImportCertificateOptions(string name, byte[] value, CertificatePolicy pol
public byte[] Value { get; }

/// <summary>
/// The policy which governs the lifecycle of the imported certificate and it's properties when it is rotated.
/// The policy which governs the lifecycle of the imported certificate and its properties when it is rotated.
/// </summary>
public CertificatePolicy Policy { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Uri KeyId
}

/// <summary>
/// The Id of the Key Vault Secret which contains the PEM of PFX formatted content of the certficate and it's private key.
/// The Id of the Key Vault Secret which contains the PEM of PFX formatted content of the certificate and its private key.
/// </summary>
public Uri SecretId
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Azure.Security.KeyVault.Certificates.Samples
{
/// <summary>
/// This sample demonstrates how to create, get, update and delete a certificate using the synchronous methods of the <see cref="CertificateClient">.
/// This sample demonstrates how to create, get, update, and delete a certificate using the synchronous methods of the <see cref="CertificateClient">.
/// </summary>
[LiveOnly]
public partial class HelloWorld
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Azure.Security.KeyVault.Certificates.Samples
{
/// <summary>
/// Sample demonstrates how to create, get, update and delete a key using the asynchronous methods of the KeyClient.
/// Sample demonstrates how to create, get, update, and delete a key using the asynchronous methods of the KeyClient.
/// </summary>
[LiveOnly]
public partial class HelloWorld
Expand All @@ -27,19 +27,19 @@ public async Task HelloWorldAsync()
// 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials.
var client = new CertificateClient(new Uri(keyVaultUrl), new DefaultAzureCredential());

// Let's create a self signed certificate using the default policy. If the certificate
// Let's create a self-signed certificate using the default policy. If the certificate
// already exists in the Key Vault, then a new version of the key is created.
string certName = $"defaultCert-{Guid.NewGuid()}";

CertificateOperation certOp = await client.StartCreateCertificateAsync(certName, CertificatePolicy.Default);

// Next let's wait on the certificate operation to complete. Note that certificate creation can last an indeterministic
// Next, let's wait on the certificate operation to complete. Note that certificate creation can last an indeterministic
// amount of time, so applications should only wait on the operation to complete in the case the issuance time is well
// known and within the scope of the application lifetime. In this case we are creating a self-signed certificate which
// should be issued in a relatively short amount of time.
KeyVaultCertificateWithPolicy certificate = await certOp.WaitForCompletionAsync();

// At some time later we could get the created certificate along with it's policy from the Key Vault.
// At some time later we could get the created certificate along with its policy from the Key Vault.
certificate = await client.GetCertificateAsync(certName);

Debug.WriteLine($"Certificate was returned with name {certificate.Name} which expires {certificate.Properties.ExpiresOn}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Azure.Security.KeyVault.Certificates.Samples
{
/// <summary>
/// Sample demonstrates how to list certificates and versions of a given certificates,
/// Sample demonstrates how to list certificates, versions of a given certificates,
/// and list deleted certificates in a soft delete-enabled key vault
/// using the synchronous methods of the CertificateClient.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Azure.Security.KeyVault.Certificates.Samples
{
/// <summary>
/// Sample demonstrates how to list certificates and versions of a given certificates,
/// Sample demonstrates how to list certificates, versions of a given certificates,
/// and list deleted certificates in a soft delete-enabled key vault
/// using the synchronous methods of the CertificateClient.
/// </summary>
Expand All @@ -38,7 +38,7 @@ public async Task GetCertificatesAsync()

CertificateOperation certOp2 = await client.StartCreateCertificateAsync(certName1, CertificatePolicy.Default);

// Next let's wait on the certificate operation to complete. Note that certificate creation can last an indeterministic
// Next, let's wait on the certificate operation to complete. Note that certificate creation can last an indeterministic
// amount of time, so applications should only wait on the operation to complete in the case the issuance time is well
// known and within the scope of the application lifetime. In this case we are creating a self-signed certificate which
// should be issued in a relatively short amount of time.
Expand Down
5 changes: 3 additions & 2 deletions sdk/keyvault/Azure.Security.KeyVault.Keys/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Azure Key Vault key client library for .NET
Azure Key Vault is a cloud service that provides secure storage of keys for encrypting your data. Multiple keys, and multiple versions of the same key, can be kept in the Key Vault. Cryptographic keys in Key Vault are represented as [JSON Web Key (JWK)][JWK] objects.

The Azure Key Vault keys library client supports RSA keys and Elliptic Curve (EC) keys, each with corresponding support in hardware security modules (HSM). It offers operations to create, retrieve, update, delete, purge, backup, restore and list the keys and its versions.
The Azure Key Vault keys library client supports RSA keys and Elliptic Curve (EC) keys, each with corresponding support in hardware security modules (HSM). It offers operations to create, retrieve, update, delete, purge, backup, restore, and list the keys and its versions.

[Source code][key_client_src] | [Package (NuGet)][key_client_nuget_package] | [API reference documentation][API_reference] | [Product documentation][keyvault_docs] | [Samples][key_client_samples]

Expand All @@ -28,7 +28,7 @@ az keyvault create --resource-group <your-resource-group-name> --name <your-key-
In order to interact with the Key Vault service, you'll need to create an instance of the [KeyClient][key_client_class] class. You would need a **vault url**, which you may see as "DNS Name" in the portal,
and **client secret credentials (client id, client secret, tenant id)** to instantiate a client object.

Client secret credential authentication is being used in this getting started section but you can find more ways to authenticate with [Azure identity][azure_identity]. To use the `DefaultAzureCredential` provider shown below,
Client secret credential authentication is being used in this getting started section but you can find more ways to authenticate with [Azure identity][azure_identity]. To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below,
or other credential providers provided with the Azure SDK, you should install the Azure.Identity package:

```PowerShell
Expand Down Expand Up @@ -404,5 +404,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[nuget]: https://www.nuget.org/
[secrets_client_library]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/keyvault/Azure.Security.KeyVault.Secrets
[soft_delete]: https://docs.microsoft.com/en-us/azure/key-vault/key-vault-ovw-soft-delete
[DefaultAzureCredential]: ../../identity/Azure.Identity/README.md

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Fkeyvault%2FAzure.Security.KeyVault.Keys%2FREADME.png)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To get started, you'll need a URI to an Azure Key Vault. See the [README](../REA
## Creating a KeyClient

To create a new `KeyClient` to create, get, update, or delete keys, you need the endpoint to a Key Vault and credentials.
You can use the `DefaultAzureCredential` to try a number of common authentication methods optimized for both running as a service and development.
You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development.

In the sample below, you can set `keyVaultUrl` based on an environment variable, configuration setting, or any way that works for your application.

Expand Down Expand Up @@ -104,3 +104,5 @@ await client.PurgeDeletedKeyAsync(rsaKeyName);

* [Synchronous Sample1_HelloWorld.cs](../tests/samples/Sample1_HelloWorld.cs)
* [Asynchronous Sample1_HelloWorldAsync.cs](../tests/samples/Sample1_HelloWorldAsync.cs)

[DefaultAzureCredential]: ../../../identity/Azure.Identity/README.md
Loading

0 comments on commit 0be76a7

Please sign in to comment.