Reputation: 3091
I created an azure key vault (not a managed HSM service) and gave myself necessary permissions in azure portal to create and view keys. I wanted to create an AES-256 bit symmetric wrapping key (also known as key encryption key or KEK) with following azure CLI command:
az keyvault key create --name mywrappingkey --vault-name raghu-keyvault-wrap-exp --kty oct --size 256 --ops wrapKey --protection software
It fails with following error:
(BadParameter) Invalid kty value: oct
Code: BadParameter
Message: Invalid kty value: oct
Inner error: {
"code": "KeyTypeNotSupported"
}
The following documentation says it should work: https://learn.microsoft.com/en-us/cli/azure/keyvault/key?view=azure-cli-latest#az-keyvault-key-create
I also tried using command (i.e. changed the --protection value to hsm):
az keyvault key create --name mywrappingkey --vault-name raghu-keyvault-wrap-exp --kty oct --size 256 --ops wrapKey --protection hsm
This time, it erred with following:
(BadParameter) Property has invalid value
Code: BadParameter
Message: Property has invalid value
Not sure what I am doing wrong here. Any ideas?
Upvotes: 0
Views: 108
Reputation: 16064
Note: Azure Key Vault does not support creating symmetric
oct
keys forwrapKey
ordecrypt
operations directly via CLI.
az keyvault key create
using the oct
type, but if you need key wrapping (KEK), you must use RSA or EC keys. For AES-256 keys, consider using Azure Key Vault Secrets to store the key. Refer this MsDocI got the same errors when creating symmetric key like below:
az keyvault key create --name mywrappingkey --vault-name KvName --kty oct --size 256 --ops wrapKey --protection software
az keyvault key create --name mywrappingkey --vault-name KvName --kty oct --size 256 --ops wrapKey --protection hsm
az keyvault key create
. The only option is storing them as secrets.Note: Azure Key Vault does not support symmetric (oct) keys for key wrapping operations. Only RSA or EC keys can be used for key wrapping (wrapKey), as AES symmetric KEKs cannot be created directly in Azure Key Vault.
Reference:
About keys - Azure Key Vault | Microsoft
Upvotes: 0