Share via


BatchClient.CreateCertificateAsync Method

Definition

Overloads

CreateCertificateAsync(BatchCertificate, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken)

Creates a Certificate to the specified Account.

CreateCertificateAsync(RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext)

[Protocol Method] Creates a Certificate to the specified Account.

CreateCertificateAsync(BatchCertificate, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken)

Source:
BatchClientCustom.cs

Creates a Certificate to the specified Account.

public virtual System.Threading.Tasks.Task<Azure.Response> CreateCertificateAsync(Azure.Compute.Batch.BatchCertificate certificate, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateCertificateAsync : Azure.Compute.Batch.BatchCertificate * Nullable<int> * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateCertificateAsync : Azure.Compute.Batch.BatchCertificate * Nullable<int> * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateCertificateAsync (certificate As BatchCertificate, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)

Parameters

certificate
BatchCertificate

The Certificate to be created.

timeOutInSeconds
Nullable<Int32>

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".

ocpdate
Nullable<DateTimeOffset>

The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

certificate is null.

Examples

This sample shows how to call CreateCertificateAsync.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

BatchCertificate certificate = new BatchCertificate("0123456789abcdef0123456789abcdef01234567", "sha1", "#####...")
{
    CertificateFormat = BatchCertificateFormat.Pfx,
    Password = "<ExamplePassword>",
};
Response response = await client.CreateCertificateAsync(certificate);

Applies to

CreateCertificateAsync(RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext)

Source:
BatchClientCustom.cs

[Protocol Method] Creates a Certificate to the specified Account.

public virtual System.Threading.Tasks.Task<Azure.Response> CreateCertificateAsync(Azure.Core.RequestContent content, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, Azure.RequestContext context = default);
abstract member CreateCertificateAsync : Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateCertificateAsync : Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateCertificateAsync (content As RequestContent, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

content
RequestContent

The content to send as the body of the request.

timeOutInSeconds
Nullable<Int32>

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".

ocpdate
Nullable<DateTimeOffset>

The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

content is null.

Service returned a non-success status code.

Examples

This sample shows how to call CreateCertificateAsync.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    thumbprintAlgorithm = "sha1",
    thumbprint = "0123456789abcdef0123456789abcdef01234567",
    data = "#####...",
    certificateFormat = "pfx",
    password = "<ExamplePassword>",
});
Response response = await client.CreateCertificateAsync(content);

Console.WriteLine(response.Status);

Applies to