diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md b/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md index 4d92c2a36488e..1b3cc75c9a1d5 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md +++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md @@ -1,7 +1,7 @@ # Azure KeyVault Administration client library for .NET -Azure Key Vault is a cloud service for securely storing and accessing secrets. A secret is anything to which you want to tightly control -access, such as API keys, passwords, or certificates. A vault is a logical group of secrets. +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. The Azure Key Vault administration library clients support administrative tasks such as full backup / restore and key-level role-based access control (RBAC). @@ -68,9 +68,9 @@ environment variables. The following example shows a way to do this in Powershel $Env:AZURE_TENANT_ID="tenant-ID" ``` -* Create the Key Vault and grant the above mentioned application authorization to perform administrative operations on the Azure Key Vault +* Create the Managed HSM and grant the above mentioned application authorization to perform administrative operations on the Managed HSM (replace `` and `` with your own, unique names and `` with the value from above): - ``` + ```PowerShell az keyvault create --hsm-name --resource-group --administrators --location ``` @@ -79,6 +79,33 @@ environment variables. The following example shows a way to do this in Powershel az keyvault show --hsm-name ``` +#### Activate your 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. + +To activate your HSM you need: +- Minimum 3 RSA key-pairs (maximum 10) +- Specify minimum number of keys required to decrypt the security domain (quorum) + +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. +Once this security domain is successfully downloaded, your HSM is ready to use. +You also need to specify quorum, which is the minimum number of private keys required to decrypt the security domain. + +The example below shows how to use openssl to generate 3 self signed certificate. + +```PowerShell +openssl req -newkey rsa:2048 -nodes -keyout cert_0.key -x509 -days 365 -out cert_0.cer +openssl req -newkey rsa:2048 -nodes -keyout cert_1.key -x509 -days 365 -out cert_1.cer +openssl req -newkey rsa:2048 -nodes -keyout cert_2.key -x509 -days 365 -out cert_2.cer +``` + +Use the `az keyvault security-domain download` command to download the security domain and activate your managed HSM. +The example below, uses 3 RSA key pairs (only public keys are needed for this command) and sets the quorum to 2. + +```PowerShell +az keyvault security-domain download --hsm-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 +``` + #### Create KeyVaultAccessControlClient Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and **AZURE_TENANT_ID** environment variables and replaced **your-vault-url** with the above returned URI, you can create the [KeyVaultAccessControlClient][rbac_client]: diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/README.md b/sdk/keyvault/Azure.Security.KeyVault.Keys/README.md index 64e3dbc0d99a1..3d0744321f8d1 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Keys/README.md +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/README.md @@ -1,5 +1,10 @@ # 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 Azure Key Vault. Cryptographic keys in Azure Key Vault are represented as [JSON Web Key (JWK)][JWK] objects. +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)][JWK] objects. + +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. 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. @@ -18,11 +23,7 @@ dotnet install Azure.Security.KeyVault.Keys * An [Azure subscription][azure_sub]. * An existing Azure Key Vault. If you need to create an Azure Key Vault, you can use the Azure Portal or [Azure CLI][azure_cli]. -If you use the Azure CLI, replace `` and `` with your own, unique names: - -```PowerShell -az keyvault create --resource-group --name -``` +See the final two steps in the next section for details on creating the Key Vault with the Azure CLI. ### Authenticate the client In order to interact with the Key Vault service, you'll need to create an instance of the [KeyClient][key_client_class] class. You need a **vault url**, which you may see as "DNS Name" in the portal, @@ -52,6 +53,14 @@ Use the [Azure CLI][azure_cli] snippet below to create/get client secret credent "tenant": "tenant-ID" } ``` +* Take note of the service principal objectId + ```PowerShell + az ad sp show --id --query objectId + ``` + Output: + ``` + "" + ``` * Use the returned credentials above 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 Powershell: ```PowerShell $Env:AZURE_CLIENT_ID="generated-app-ID" @@ -71,6 +80,46 @@ Use the [Azure CLI][azure_cli] snippet below to create/get client secret credent az keyvault show --name ``` +* Create the Azure Key Vault or Managed HSM and grant the above mentioned application authorization to perform administrative operations on the Managed HSM +(replace `` and `` with your own unique names and `` with the value from above): + +If you are creating a standard Key Vault resource, use the following CLI command: +```PowerShell +az keyvault create --resource-group --name +``` + +If you are creating a Managed HSM resource, use the following CLI command: +```PowerShell + az keyvault create --hsm-name --resource-group --administrators --location +``` + +#### Activate your managed HSM +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. + +To activate your HSM you need: +- Minimum 3 RSA key-pairs (maximum 10) +- Specify minimum number of keys required to decrypt the security domain (quorum) + +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. +Once this security domain is successfully downloaded, your HSM is ready to use. +You also need to specify quorum, which is the minimum number of private keys required to decrypt the security domain. + +The example below shows how to use openssl to generate 3 self signed certificate. + +```PowerShell +openssl req -newkey rsa:2048 -nodes -keyout cert_0.key -x509 -days 365 -out cert_0.cer +openssl req -newkey rsa:2048 -nodes -keyout cert_1.key -x509 -days 365 -out cert_1.cer +openssl req -newkey rsa:2048 -nodes -keyout cert_2.key -x509 -days 365 -out cert_2.cer +``` + +Use the `az keyvault security-domain download` command to download the security domain and activate your managed HSM. +The example below uses 3 RSA key pairs (only public keys are needed for this command) and sets the quorum to 2. + +```PowerShell +az keyvault security-domain download --hsm-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 +``` + #### Create KeyClient Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and **AZURE_TENANT_ID** environment variables and replaced **your-vault-url** with the above returned URI, you can create the [KeyClient][key_client_class]: @@ -371,11 +420,14 @@ Several Azure Key Vault keys client library samples are available to you in this ## Contributing See the [CONTRIBUTING.md][contributing] for details on building, testing, and contributing to these libraries. -This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) +declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). +Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. -This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact opencode@microsoft.com with any additional questions or comments. +This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. +For more information see the [Code of Conduct FAQ][coc_faq] or contact opencode@microsoft.com with any additional questions or comments. [API_reference]: https://docs.microsoft.com/dotnet/api/azure.security.keyvault.keys