@@ -9,7 +9,7 @@ tags: azure-resource-manager
9
9
ms.service : key-vault
10
10
ms.subservice : keys
11
11
ms.topic : tutorial
12
- ms.date : 11/21/2022
12
+ ms.date : 03/07/2023
13
13
ms.author : mbaldwin
14
14
15
15
---
@@ -67,7 +67,6 @@ The following table lists prerequisites for using BYOK in Azure Key Vault:
67
67
| Utimaco| Manufacturer,<br />HSM as a service| u.trust Anchor, CryptoServer| Utimaco BYOK tool and Integration guide |
68
68
||||
69
69
70
-
71
70
## Supported key types
72
71
73
72
| Key name| Key type| Key size/curve| Origin| Description|
@@ -101,29 +100,62 @@ The KEK must be:
101
100
102
101
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 ) .)
103
102
103
+ ### [ Azure CLI] ( #tab/azure-cli )
104
+
104
105
``` azurecli
105
106
az keyvault key create --kty RSA-HSM --size 4096 --name KEKforBYOK --ops import --vault-name ContosoKeyVaultHSM
106
107
```
107
- or for Managed HSM
108
+
109
+ For Managed HSM:
108
110
109
111
``` azurecli
110
112
az keyvault key create --kty RSA-HSM --size 4096 --name KEKforBYOK --ops import --hsm-name ContosoKeyVaultHSM
111
113
```
112
114
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
+
113
129
### Download the KEK public key
114
130
115
131
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.
116
132
133
+ ### [ Azure CLI] ( #tab/azure-cli )
134
+
117
135
``` azurecli
118
136
az keyvault key download --name KEKforBYOK --vault-name ContosoKeyVaultHSM --file KEKforBYOK.publickey.pem
119
137
```
120
138
121
- or for Managed HSM
139
+ For Managed HSM:
122
140
123
141
``` azurecli
124
142
az keyvault key download --name KEKforBYOK --hsm-name ContosoKeyVaultHSM --file KEKforBYOK.publickey.pem
125
143
```
126
144
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
+
127
159
Transfer the KEKforBYOK.publickey.pem file to your offline computer. You will need this file in the next step.
128
160
129
161
### 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.
132
164
133
165
Transfer the BYOK file to your connected computer.
134
166
135
- > [ !NOTE]
167
+ > [ !NOTE]
136
168
> Importing RSA 1,024-bit keys is not supported. Importing Elliptic Curve key with curve P-256K is not supported.
137
- >
169
+ >
138
170
> ** Known issue** : Importing an RSA 4K target key from Luna HSMs is only supported with firmware 7.4.0 or newer.
139
171
140
172
### 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
143
175
144
176
To import an RSA key use following command. Parameter --kty is optional and defaults to 'RSA-HSM'.
145
177
178
+ ### [ Azure CLI] ( #tab/azure-cli )
179
+
146
180
``` azurecli
147
181
az keyvault key import --vault-name ContosoKeyVaultHSM --name ContosoFirstHSMkey --byok-file KeyTransferPackage-ContosoFirstHSMkey.byok
148
182
```
149
183
150
- or for Managed HSM
184
+ For Managed HSM
151
185
152
186
``` azurecli
153
187
az keyvault key import --hsm-name ContosoKeyVaultHSM --name ContosoFirstHSMkey --byok-file KeyTransferPackage-ContosoFirstHSMkey.byok
154
188
```
155
189
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
+
156
203
To import an EC key, you must specify key type and the curve name.
157
204
205
+ ### [ Azure CLI] ( #tab/azure-cli )
206
+
158
207
``` 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
160
209
```
161
210
162
- or for Managed HSM
211
+ For Managed HSM
163
212
164
213
``` azurecli
165
214
az keyvault key import --hsm-name ContosoKeyVaultHSM --name ContosoFirstHSMkey --byok-file --kty EC-HSM --curve-name "P-256" KeyTransferPackage-ContosoFirstHSMkey.byok
166
215
```
167
216
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
+
168
231
If the upload is successful, Azure CLI displays the properties of the imported key.
169
232
170
233
## Next steps
0 commit comments