Udostępnij za pośrednictwem


KeyVaultClient.CreateKeyWithHttpMessagesAsync Method

Definition

Creates a new key, stores it, then returns key parameters and attributes to the client.

public System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.KeyVault.Models.KeyBundle>> CreateKeyWithHttpMessagesAsync (string vaultBaseUrl, string keyName, string kty, int? keySize = default, System.Collections.Generic.IList<string> keyOps = default, Microsoft.Azure.KeyVault.Models.KeyAttributes keyAttributes = default, System.Collections.Generic.IDictionary<string,string> tags = default, string curve = default, System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>> customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateKeyWithHttpMessagesAsync : string * string * string * Nullable<int> * System.Collections.Generic.IList<string> * Microsoft.Azure.KeyVault.Models.KeyAttributes * System.Collections.Generic.IDictionary<string, string> * string * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.KeyVault.Models.KeyBundle>>
override this.CreateKeyWithHttpMessagesAsync : string * string * string * Nullable<int> * System.Collections.Generic.IList<string> * Microsoft.Azure.KeyVault.Models.KeyAttributes * System.Collections.Generic.IDictionary<string, string> * string * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.KeyVault.Models.KeyBundle>>
Public Function CreateKeyWithHttpMessagesAsync (vaultBaseUrl As String, keyName As String, kty As String, Optional keySize As Nullable(Of Integer) = Nothing, Optional keyOps As IList(Of String) = Nothing, Optional keyAttributes As KeyAttributes = Nothing, Optional tags As IDictionary(Of String, String) = Nothing, Optional curve As String = Nothing, Optional customHeaders As Dictionary(Of String, List(Of String)) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of AzureOperationResponse(Of KeyBundle))

Parameters

vaultBaseUrl
String

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

keyName
String

The name for the new key. The system will generate the version name for the new key.

kty
String

The type of key to create. For valid values, see JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'

keySize
Nullable<Int32>

The key size in bytes. For example, 1024 or 2048.

keyOps
IList<String>
keyAttributes
KeyAttributes
tags
IDictionary<String,String>

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

curve
String

Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', 'SECP256K1'

customHeaders
Dictionary<String,List<String>>

Headers that will be added to request.

cancellationToken
CancellationToken

The cancellation token.

Returns

Implements

Exceptions

Thrown when the operation returned an invalid status code

Thrown when unable to deserialize the response

Thrown when a required parameter is null

Thrown when a required parameter is null

Remarks

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.

Applies to