Skip to content

Commit c577ed4

Browse files
Merge pull request #230472 from msmbaldwin/mhsm-jrichins
Mhsm jrichins
2 parents e56be3c + ef1df71 commit c577ed4

File tree

1 file changed

+72
-9
lines changed

1 file changed

+72
-9
lines changed

articles/key-vault/keys/hsm-protected-keys-byok.md

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tags: azure-resource-manager
99
ms.service: key-vault
1010
ms.subservice: keys
1111
ms.topic: tutorial
12-
ms.date: 11/21/2022
12+
ms.date: 03/07/2023
1313
ms.author: mbaldwin
1414

1515
---
@@ -67,7 +67,6 @@ The following table lists prerequisites for using BYOK in Azure Key Vault:
6767
|Utimaco|Manufacturer,<br/>HSM as a service|u.trust Anchor, CryptoServer| Utimaco BYOK tool and Integration guide |
6868
||||
6969

70-
7170
## Supported key types
7271

7372
|Key name|Key type|Key size/curve|Origin|Description|
@@ -101,29 +100,62 @@ The KEK must be:
101100
102101
Use the [az keyvault key create](/cli/azure/keyvault/key#az-keyvault-key-create) command to create a KEK that has key operations set to `import`. Record the key identifier (`kid`) that's returned from the following command. (You will use the `kid` value in [Step 3](#generate-and-prepare-your-key-for-transfer).)
103102

103+
### [Azure CLI](#tab/azure-cli)
104+
104105
```azurecli
105106
az keyvault key create --kty RSA-HSM --size 4096 --name KEKforBYOK --ops import --vault-name ContosoKeyVaultHSM
106107
```
107-
or for Managed HSM
108+
109+
For Managed HSM:
108110

109111
```azurecli
110112
az keyvault key create --kty RSA-HSM --size 4096 --name KEKforBYOK --ops import --hsm-name ContosoKeyVaultHSM
111113
```
112114

115+
### [Azure PowerShell](#tab/azure-powershell)
116+
117+
```azurepowershell
118+
Add-AzKeyVaultKey -VaultName 'ContosoKeyVaultHSM' -Name 'KEKforBYOK' -Destination 'HSM' -Size 4096 -KeyOps 'import'
119+
```
120+
121+
For Managed HSM:
122+
123+
```azurepowershell
124+
Add-AzKeyVaultKey -HsmName 'ContosoKeyVaultHSM' -Name 'KEKforBYOK' -Destination 'HSM' -Size 4096 -KeyOps 'import'
125+
```
126+
127+
---
128+
113129
### Download the KEK public key
114130

115131
Use [az keyvault key download](/cli/azure/keyvault/key#az-keyvault-key-download) to download the KEK public key to a .pem file. The target key you import is encrypted by using the KEK public key.
116132

133+
### [Azure CLI](#tab/azure-cli)
134+
117135
```azurecli
118136
az keyvault key download --name KEKforBYOK --vault-name ContosoKeyVaultHSM --file KEKforBYOK.publickey.pem
119137
```
120138

121-
or for Managed HSM
139+
For Managed HSM:
122140

123141
```azurecli
124142
az keyvault key download --name KEKforBYOK --hsm-name ContosoKeyVaultHSM --file KEKforBYOK.publickey.pem
125143
```
126144

145+
### [Azure PowerShell](#tab/azure-powershell)
146+
147+
```azurepowershell
148+
Get-AzKeyVaultKey -VaultName 'ContosoKeyVaultHSM' -KeyName 'KEKforBYOK' -OutFile 'KEKforBYOK.publickey.pem'
149+
```
150+
151+
For Managed HSM
152+
153+
```azurepowershell
154+
Get-AzKeyVaultKey -HsmName 'ContosoKeyVaultHSM' -KeyName 'KEKforBYOK' -OutFile 'KEKforBYOK.publickey.pem'
155+
```
156+
157+
---
158+
127159
Transfer the KEKforBYOK.publickey.pem file to your offline computer. You will need this file in the next step.
128160

129161
### Generate and prepare your key for transfer
@@ -132,9 +164,9 @@ Refer to your HSM vendor's documentation to download and install the BYOK tool.
132164

133165
Transfer the BYOK file to your connected computer.
134166

135-
> [!NOTE]
167+
> [!NOTE]
136168
> Importing RSA 1,024-bit keys is not supported. Importing Elliptic Curve key with curve P-256K is not supported.
137-
>
169+
>
138170
> **Known issue**: Importing an RSA 4K target key from Luna HSMs is only supported with firmware 7.4.0 or newer.
139171
140172
### Transfer your key to Azure Key Vault
@@ -143,28 +175,59 @@ To complete the key import, transfer the key transfer package (a BYOK file) from
143175

144176
To import an RSA key use following command. Parameter --kty is optional and defaults to 'RSA-HSM'.
145177

178+
### [Azure CLI](#tab/azure-cli)
179+
146180
```azurecli
147181
az keyvault key import --vault-name ContosoKeyVaultHSM --name ContosoFirstHSMkey --byok-file KeyTransferPackage-ContosoFirstHSMkey.byok
148182
```
149183

150-
or for Managed HSM
184+
For Managed HSM
151185

152186
```azurecli
153187
az keyvault key import --hsm-name ContosoKeyVaultHSM --name ContosoFirstHSMkey --byok-file KeyTransferPackage-ContosoFirstHSMkey.byok
154188
```
155189

190+
### [Azure PowerShell](#tab/azure-powershell)
191+
192+
```azurepowershell
193+
Add-AzKeyVaultKey -VaultName 'ContosoKeyVaultHSM' -KeyName 'ContosoFirstHSMkey' -KeyFilePath 'KeyTransferPackage-ContosoFirstHSMkey.byok'
194+
```
195+
For Managed HSM
196+
197+
```azurepowershell
198+
Add-AzKeyVaultKey -HsmName 'ContosoKeyVaultHSM' -KeyName 'ContosoFirstHSMkey' -KeyFilePath 'KeyTransferPackage-ContosoFirstHSMkey.byok'
199+
```
200+
201+
---
202+
156203
To import an EC key, you must specify key type and the curve name.
157204

205+
### [Azure CLI](#tab/azure-cli)
206+
158207
```azurecli
159-
az keyvault key import --vault-name ContosoKeyVaultHSM --name ContosoFirstHSMkey --byok-file --kty EC-HSM --curve-name "P-256" KeyTransferPackage-ContosoFirstHSMkey.byok
208+
az keyvault key import --vault-name ContosoKeyVaultHSM --name ContosoFirstHSMkey --kty EC-HSM --curve-name "P-256" --byok-file KeyTransferPackage-ContosoFirstHSMkey.byok
160209
```
161210

162-
or for Managed HSM
211+
For Managed HSM
163212

164213
```azurecli
165214
az keyvault key import --hsm-name ContosoKeyVaultHSM --name ContosoFirstHSMkey --byok-file --kty EC-HSM --curve-name "P-256" KeyTransferPackage-ContosoFirstHSMkey.byok
166215
```
167216

217+
### [Azure PowerShell](#tab/azure-powershell)
218+
219+
```azurepowershell
220+
Add-AzKeyVaultKey -VaultName 'ContosoKeyVaultHSM' -KeyName 'ContosoFirstHSMkey' -KeyType EC -CurveName P-256 -KeyFilePath 'KeyTransferPackage-ContosoFirstHSMkey.byok'
221+
```
222+
223+
For Managed HSM
224+
225+
```azurepowershell
226+
Add-AzKeyVaultKey -HsmName 'ContosoKeyVaultHSM' -KeyName 'ContosoFirstHSMkey' -KeyType EC -CurveName P-256 -KeyFilePath 'KeyTransferPackage-ContosoFirstHSMkey.byok'
227+
```
228+
229+
---
230+
168231
If the upload is successful, Azure CLI displays the properties of the imported key.
169232

170233
## Next steps

0 commit comments

Comments
 (0)