Create Key - Create Key - REST API (Azure Key Vault) (2024)

  • Reference
Service:
Key Vault
API Version:
7.4

Creates a new key, stores it, then returns key parameters and attributes to the client.
The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the keys/create permission.

POST {vaultBaseUrl}/keys/{key-name}/create?api-version=7.4

URI Parameters

NameInRequiredTypeDescription

key-name

pathTrue

string

The name for the new key. The system will generate the version name for the new key. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.

Regex pattern: ^[0-9a-zA-Z-]+$

vaultBaseUrl

pathTrue

string

The vault name, for example https://myvault.vault.azure.net.

api-version

queryTrue

string

Client API version.

Request Body

NameRequiredTypeDescription
ktyTrue

JsonWebKeyType

The type of key to create. For valid values, see JsonWebKeyType.

attributes

KeyAttributes

The attributes of a key managed by the key vault service.

crv

JsonWebKeyCurveName

Elliptic curve name. For valid values, see JsonWebKeyCurveName.

key_ops

JsonWebKeyOperation[]

JSON web key operations. For more information, see JsonWebKeyOperation.

key_size

integer

The key size in bits. For example: 2048, 3072, or 4096 for RSA.

public_exponent

integer

The public exponent for a RSA key.

release_policy

KeyReleasePolicy

The policy rules under which the key can be exported.

tags

object

Application specific metadata in the form of key-value pairs.

Responses

NameTypeDescription
200 OK

KeyBundle

A key bundle containing the result of the create key request.

Other Status Codes

KeyVaultError

Key Vault error response describing why the operation failed.

Examples

Create key

Sample request

  • HTTP
POST https://myvault.vault.azure.net//keys/CreateSoftKeyTest/create?api-version=7.4{ "kty": "RSA", "key_size": 2048, "key_ops": [ "encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey" ], "attributes": {}, "tags": { "purpose": "unit test", "test name ": "CreateGetDeleteKeyTest" }}

Sample response

Status code:
200
{ "key": { "kid": "https://myvault.vault.azure.net/keys/CreateSoftKeyTest/78deebed173b48e48f55abf87ed4cf71", "kty": "RSA", "key_ops": [ "encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey" ], "n": "2HJAE5fU3Cw2Rt9hEuq-F6XjINKGa-zskfISVqopqUy60GOs2eyhxbWbJBeUXNor_gf-tXtNeuqeBgitLeVa640UDvnEjYTKWjCniTxZRaU7ewY8BfTSk-7KxoDdLsPSpX_MX4rwlAx-_1UGk5t4sQgTbm9T6Fm2oqFd37dsz5-Gj27UP2GTAShfJPFD7MqU_zIgOI0pfqsbNL5xTQVM29K6rX4jSPtylZV3uWJtkoQIQnrIHhk1d0SC0KwlBV3V7R_LVYjiXLyIXsFzSNYgQ68ZjAwt8iL7I8Osa-ehQLM13DVvLASaf7Jnu3sC3CWl3Gyirgded6cfMmswJzY87w", "e": "AQAB" }, "attributes": { "enabled": true, "created": 1493942451, "updated": 1493942451, "recoveryLevel": "Recoverable+Purgeable" }, "tags": { "purpose": "unit test", "test name ": "CreateGetDeleteKeyTest" }}

Definitions

NameDescription
DeletionRecoveryLevel

Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention interval.

Error

The key vault server error.

JsonWebKey

As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18

JsonWebKeyCurveName

Elliptic curve name. For valid values, see JsonWebKeyCurveName.

JsonWebKeyOperation
JsonWebKeyType

JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40.

KeyAttributes

The attributes of a key managed by the key vault service.

KeyBundle

A KeyBundle consisting of a WebKey plus its attributes.

KeyCreateParameters

The key create parameters.

KeyReleasePolicy

The policy rules under which the key can be exported.

KeyVaultError

The key vault error exception.

DeletionRecoveryLevel

Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention interval.

NameTypeDescription
CustomizedRecoverable

string

Denotes a vault state in which deletion is recoverable without the possibility for immediate and permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90).This level guarantees the recoverability of the deleted entity during the retention interval and while the subscription is still available.

CustomizedRecoverable+ProtectedSubscription

string

Denotes a vault and subscription state in which deletion is recoverable, immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot be permanently canceled when 7<= SoftDeleteRetentionInDays < 90. This level guarantees the recoverability of the deleted entity during the retention interval, and also reflects the fact that the subscription itself cannot be cancelled.

CustomizedRecoverable+Purgeable

string

Denotes a vault state in which deletion is recoverable, and which also permits immediate and permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees the recoverability of the deleted entity during the retention interval, unless a Purge operation is requested, or the subscription is cancelled.

Purgeable

string

Denotes a vault state in which deletion is an irreversible operation, without the possibility for recovery. This level corresponds to no protection being available against a Delete operation; the data is irretrievably lost upon accepting a Delete operation at the entity level or higher (vault, resource group, subscription etc.)

Recoverable

string

Denotes a vault state in which deletion is recoverable without the possibility for immediate and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the retention interval(90 days) and while the subscription is still available. System wil permanently delete it after 90 days, if not recovered

Recoverable+ProtectedSubscription

string

Denotes a vault and subscription state in which deletion is recoverable within retention interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot be permanently canceled. System wil permanently delete it after 90 days, if not recovered

Recoverable+Purgeable

string

Denotes a vault state in which deletion is recoverable, and which also permits immediate and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the retention interval (90 days), unless a Purge operation is requested, or the subscription is cancelled. System wil permanently delete it after 90 days, if not recovered

Error

The key vault server error.

NameTypeDescription
code

string

The error code.

innererror

Error

The key vault server error.

message

string

The error message.

JsonWebKey

As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18

NameTypeDescription
crv

JsonWebKeyCurveName

Elliptic curve name. For valid values, see JsonWebKeyCurveName.

d

string

RSA private exponent, or the D component of an EC private key.

dp

string

RSA private key parameter.

dq

string

RSA private key parameter.

e

string

RSA public exponent.

k

string

Symmetric key.

key_hsm

string

Protected Key, used with 'Bring Your Own Key'.

key_ops

string[]

Supported key operations.

kid

string

Key identifier.

kty

JsonWebKeyType

JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40.

n

string

RSA modulus.

p

string

RSA secret prime.

q

string

RSA secret prime, with p < q.

qi

string

RSA private key parameter.

x

string

X component of an EC public key.

y

string

Y component of an EC public key.

JsonWebKeyCurveName

Elliptic curve name. For valid values, see JsonWebKeyCurveName.

NameTypeDescription
P-256

string

The NIST P-256 elliptic curve, AKA SECG curve SECP256R1.

P-256K

string

The SECG SECP256K1 elliptic curve.

P-384

string

The NIST P-384 elliptic curve, AKA SECG curve SECP384R1.

P-521

string

The NIST P-521 elliptic curve, AKA SECG curve SECP521R1.

JsonWebKeyOperation

NameTypeDescription
decrypt

string

encrypt

string

export

string

import

string

sign

string

unwrapKey

string

verify

string

wrapKey

string

JsonWebKeyType

JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40.

NameTypeDescription
EC

string

Elliptic Curve.

EC-HSM

string

Elliptic Curve with a private key which is stored in the HSM.

RSA

string

RSA (https://tools.ietf.org/html/rfc3447)

RSA-HSM

string

RSA with a private key which is stored in the HSM.

oct

string

Octet sequence (used to represent symmetric keys)

oct-HSM

string

Octet sequence (used to represent symmetric keys) which is stored the HSM.

KeyAttributes

The attributes of a key managed by the key vault service.

NameTypeDescription
created

integer

Creation time in UTC.

enabled

boolean

Determines whether the object is enabled.

exp

integer

Expiry date in UTC.

exportable

boolean

Indicates if the private key can be exported. Release policy must be provided when creating the first version of an exportable key.

nbf

integer

Not before date in UTC.

recoverableDays

integer

softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0.

recoveryLevel

DeletionRecoveryLevel

Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention interval.

updated

integer

Last updated time in UTC.

KeyBundle

A KeyBundle consisting of a WebKey plus its attributes.

NameTypeDescription
attributes

KeyAttributes

The key management attributes.

key

JsonWebKey

The Json web key.

managed

boolean

True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true.

release_policy

KeyReleasePolicy

The policy rules under which the key can be exported.

tags

object

Application specific metadata in the form of key-value pairs.

KeyCreateParameters

The key create parameters.

NameTypeDescription
attributes

KeyAttributes

The attributes of a key managed by the key vault service.

crv

JsonWebKeyCurveName

Elliptic curve name. For valid values, see JsonWebKeyCurveName.

key_ops

JsonWebKeyOperation[]

JSON web key operations. For more information, see JsonWebKeyOperation.

key_size

integer

The key size in bits. For example: 2048, 3072, or 4096 for RSA.

kty

JsonWebKeyType

The type of key to create. For valid values, see JsonWebKeyType.

public_exponent

integer

The public exponent for a RSA key.

release_policy

KeyReleasePolicy

The policy rules under which the key can be exported.

tags

object

Application specific metadata in the form of key-value pairs.

KeyReleasePolicy

The policy rules under which the key can be exported.

NameTypeDefault valueDescription
contentType

string

application/json; charset=utf-8

Content type and version of key release policy

data

string

Blob encoding the policy rules under which the key can be released. Blob must be base64 URL encoded.

immutable

boolean

Defines the mutability state of the policy. Once marked immutable, this flag cannot be reset and the policy cannot be changed under any circ*mstances.

KeyVaultError

The key vault error exception.

NameTypeDescription
error

Error

The key vault server error.

Create Key - Create Key - REST API (Azure Key Vault) (2024)
Top Articles
Wealthiest countries in South America 2022 | Statista
Center Parcs urges guests to respect rule of six when booking
Diario Las Americas Rentas Hialeah
Libiyi Sawsharpener
Cottonwood Vet Ottawa Ks
Junk Cars For Sale Craigslist
Lifebridge Healthstream
Toyota Campers For Sale Craigslist
Es.cvs.com/Otchs/Devoted
Undergraduate Programs | Webster Vienna
The Realcaca Girl Leaked
Miss Carramello
Jonathan Freeman : "Double homicide in Rowan County leads to arrest" - Bgrnd Search
Binghamton Ny Cars Craigslist
4156303136
Les Schwab Product Code Lookup
Missed Connections Dayton Ohio
Paradise leaked: An analysis of offshore data leaks
Sport-News heute – Schweiz & International | aktuell im Ticker
St Maries Idaho Craigslist
Pretend Newlyweds Nikubou Maranoshin
Faurot Field Virtual Seating Chart
Apple Original Films and Skydance Animation’s highly anticipated “Luck” to premiere globally on Apple TV+ on Friday, August 5
Robeson County Mugshots 2022
Rufus Benton "Bent" Moulds Jr. Obituary 2024 - Webb & Stephens Funeral Homes
Team C Lakewood
Jeff Nippard Push Pull Program Pdf
Utexas Iot Wifi
SOGo Groupware - Rechenzentrum Universität Osnabrück
Divide Fusion Stretch Hoodie Daunenjacke für Herren | oliv
Horses For Sale In Tn Craigslist
Sams Gas Price Sanford Fl
Miller Plonka Obituaries
Town South Swim Club
Ewg Eucerin
Kleinerer: in Sinntal | markt.de
Courtney Roberson Rob Dyrdek
2487872771
Rogold Extension
Old Peterbilt For Sale Craigslist
Barber Gym Quantico Hours
Pay Entergy Bill
Hometown Pizza Sheridan Menu
Japanese Big Natural Boobs
Colorado Parks And Wildlife Reissue List
Executive Lounge - Alle Informationen zu der Lounge | reisetopia Basics
Mbfs Com Login
Thothd Download
Lorton Transfer Station
Sinai Sdn 2023
Ewwwww Gif
Puss In Boots: The Last Wish Showtimes Near Valdosta Cinemas
Latest Posts
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 5904

Rating: 4 / 5 (71 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.