Skip to content

Commit bea489b

Browse files
vcolin7mccoyp
andauthored
Updated KV Certificates, Keys and Secrets READMEs to mention Managed HSM. (Azure#22342)
* Updated KV Certificates, Keys and Secrets READMEs to mention Managed HSM. * Update sdk/keyvault/azure-security-keyvault-certificates/README.md Co-authored-by: McCoy Patiño <39780829+mccoyp@users.noreply.github.com> Co-authored-by: McCoy Patiño <39780829+mccoyp@users.noreply.github.com>
1 parent c2c5265 commit bea489b

File tree

3 files changed

+63
-3
lines changed

3 files changed

+63
-3
lines changed

sdk/keyvault/azure-security-keyvault-certificates/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Here is an [Azure Cloud Shell][azure_cloud_shell] snippet below to
7373
> --certificate-permissions:
7474
> Accepted values: backup, create, delete, deleteissuers, get, getissuers, import, list, listissuers, managecontacts, manageissuers, purge, recover, restore, setissuers, update
7575
76+
If you have enabled role-based access control (RBAC) for Key Vault instead, you can find roles like "Key Vault Certificates Officer" in our [RBAC guide][rbac_guide].
77+
7678
* Use the aforementioned Key Vault name to retrieve details of your Key Vault, which also contain your Key Vault URL:
7779
7880
```Bash
@@ -338,5 +340,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][microsoft_c
338340
[jwk_specification]: https://tools.ietf.org/html/rfc7517
339341
[http_clients_wiki]: https://github.com/Azure/azure-sdk-for-java/wiki/HTTP-clients
340342
[microsoft_code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
343+
[rbac_guide]: https://docs.microsoft.com/azure/key-vault/general/rbac-guide
341344
342345
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fkeyvault%2Fazure-security-keyvault-certificates%2FREADME.png)

sdk/keyvault/azure-security-keyvault-keys/README.md

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Azure Key Vault Key client library for Java
2-
Azure Key Vault allows you to create, manage and store keys in the Key Vault. The Azure Key Vault Keys client library supports RSA keys and elliptic curve keys, each with corresponding support in hardware security modules (HSM).
2+
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 Azure Key Vault. Cryptographic keys in Azure Key Vault are represented as JSON Web Key (JWK) objects.
33

4-
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_specification] objects. This library offers operations to create, retrieve, update, delete, purge, backup, restore and list the keys, as well as its versions.
4+
Azure Key Vault Managed HSM is a fully-managed, highly-available, single-tenant, standards-compliant cloud service that enables you to safeguard cryptographic keys for your cloud applications using FIPS 140-2 Level 3 validated HSMs.
5+
6+
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.
57

68
[Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][azkeyvault_docs] | [Samples][keys_samples]
79

@@ -56,7 +58,16 @@ Here is an [Azure Cloud Shell][azure_cloud_shell] snippet below to
5658
}
5759
```
5860
59-
* Use the above returned credentials information to set the **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:
61+
* Take note of the service principal objectId
62+
```PowerShell
63+
az ad sp show --id <appId> --query objectId
64+
```
65+
Output:
66+
```
67+
"<your-service-principal-object-id>"
68+
```
69+
70+
* Use the returned credentials above to set the **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:
6071
6172
```Bash
6273
export AZURE_CLIENT_ID="generated-app-ID"
@@ -73,12 +84,53 @@ Here is an [Azure Cloud Shell][azure_cloud_shell] snippet below to
7384
> --key-permissions:
7485
> Accepted values: backup, delete, get, list, purge, recover, restore, create, update, encrypt, decrypt, import, wrapkey, unwrapkey, verify, sign
7586
87+
If you have enabled role-based access control (RBAC) for Key Vault instead, you can find roles like "Key Vault Crypto Officer" in our [RBAC guide][rbac_guide].
88+
If you are managing your keys using Managed HSM, read about its [access control][access_control] that supports different built-in roles isolated from Azure Resource Manager (ARM).
89+
7690
* Use the aforementioned Key Vault name to retrieve details of your Key Vault, which also contain your Key Vault URL:
7791
7892
```Bash
7993
az keyvault show --name <your-key-vault-name>
8094
```
8195
96+
* Create the Azure Key Vault or Managed HSM and grant the above mentioned application authorization to perform administrative operations on the Managed HSM (replace `<your-resource-group-name>` and `<your-key-vault-name>` with your own unique names and `<your-service-principal-object-id>` with the value from above):
97+
98+
If you are creating a standard Key Vault resource, use the following CLI command:
99+
```bash
100+
az keyvault create --resource-group <your-resource-group-name> --name <your-key-vault-name>
101+
```
102+
103+
If you are creating a Managed HSM resource, use the following CLI command:
104+
```bash
105+
az keyvault create --hsm-name <your-key-vault-name> --resource-group <your-resource-group-name> --administrators <your-service-principal-object-id> --location <your-azure-location>
106+
```
107+
108+
#### Activate your managed HSM
109+
This section only applies if you are creating a Managed HSM. All data plane commands are disabled until the HSM is activated. You will not be able to create keys or assign roles. Only the designated administrators that were assigned during the create command can activate the HSM. To activate the HSM you must download the security domain.
110+
111+
To activate your HSM you need:
112+
- Minimum 3 RSA key-pairs (maximum 10)
113+
- Specify minimum number of keys required to decrypt the security domain (quorum)
114+
115+
To activate the HSM you send at least 3 (maximum 10) RSA public keys to the HSM. The HSM encrypts the security domain with these keys and sends it back.
116+
Once this security domain is successfully downloaded, your HSM is ready to use.
117+
You also need to specify quorum, which is the minimum number of private keys required to decrypt the security domain.
118+
119+
The example below shows how to use openssl to generate 3 self signed certificate.
120+
121+
```bash
122+
openssl req -newkey rsa:2048 -nodes -keyout cert_0.key -x509 -days 365 -out cert_0.cer
123+
openssl req -newkey rsa:2048 -nodes -keyout cert_1.key -x509 -days 365 -out cert_1.cer
124+
openssl req -newkey rsa:2048 -nodes -keyout cert_2.key -x509 -days 365 -out cert_2.cer
125+
```
126+
127+
Use the `az keyvault security-domain download` command to download the security domain and activate your managed HSM.
128+
The example below uses 3 RSA key pairs (only public keys are needed for this command) and sets the quorum to 2.
129+
130+
```bash
131+
az keyvault security-domain download --hsm-name <your-key-vault-name> --sd-wrapping-keys ./certs/cert_0.cer ./certs/cert_1.cer ./certs/cert_2.cer --sd-quorum 2 --security-domain-file ContosoMHSM-SD.json
132+
```
133+
82134
#### Create Key client
83135
Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET**, and **AZURE_TENANT_ID** environment variables and replaced **your-key-vault-url** with the URI returned above, you can create the KeyClient:
84136

@@ -432,5 +484,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][microsoft_c
432484
[jwk_specification]: https://tools.ietf.org/html/rfc7517
433485
[http_clients_wiki]: https://github.com/Azure/azure-sdk-for-java/wiki/HTTP-clients
434486
[microsoft_code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
487+
[access_control]: https://docs.microsoft.com/azure/key-vault/managed-hsm/access-control
488+
[rbac_guide]: https://docs.microsoft.com/azure/key-vault/general/rbac-guide
435489
436490
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fkeyvault%2Fazure-security-keyvault-keys%2FREADME.png)

sdk/keyvault/azure-security-keyvault-secrets/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ Here is an [Azure Cloud Shell][azure_cloud_shell] snippet below to
7676
> --secret-permissions:
7777
> Accepted values: backup, delete, get, list, purge, recover, restore, set
7878
79+
If you have enabled role-based access control (RBAC) for Key Vault instead, you can find roles like "Key Vault Secrets Officer" in our [RBAC guide][rbac_guide].
80+
7981
* Use the aforementioned Key Vault name to retrieve details of your Vault, which also contain your Key Vault URL:
8082
8183
```Bash
@@ -320,5 +322,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][microsoft_c
320322
[azure_cloud_shell]: https://shell.azure.com/bash
321323
[http_clients_wiki]: https://github.com/Azure/azure-sdk-for-java/wiki/HTTP-clients
322324
[microsoft_code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
325+
[rbac_guide]: https://docs.microsoft.com/azure/key-vault/general/rbac-guide
323326
324327
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fkeyvault%2Fazure-security-keyvault-secrets%2FREADME.png)

0 commit comments

Comments
 (0)