BatchClient.CreateCertificate Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreateCertificate(BatchCertificate, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken) |
Creates a Certificate to the specified Account. |
CreateCertificate(RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext) |
[Protocol Method] Creates a Certificate to the specified Account.
|
CreateCertificate(BatchCertificate, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken)
- Source:
- BatchClient.cs
Creates a Certificate to the specified Account.
public virtual Azure.Response CreateCertificate(Azure.Compute.Batch.BatchCertificate certificate, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateCertificate : Azure.Compute.Batch.BatchCertificate * Nullable<int> * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> Azure.Response
override this.CreateCertificate : Azure.Compute.Batch.BatchCertificate * Nullable<int> * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> Azure.Response
Public Overridable Function CreateCertificate (certificate As BatchCertificate, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response
Parameters
- certificate
- BatchCertificate
The Certificate to be created.
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 CreateCertificate.
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 = client.CreateCertificate(certificate);
Applies to
CreateCertificate(RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestContext)
- Source:
- BatchClient.cs
[Protocol Method] Creates a Certificate to the specified Account.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler CreateCertificate(BatchCertificate, Nullable<Int32>, Nullable<DateTimeOffset>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response CreateCertificate(Azure.Core.RequestContent content, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, Azure.RequestContext context = default);
abstract member CreateCertificate : Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> Azure.Response
override this.CreateCertificate : Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestContext -> Azure.Response
Public Overridable Function CreateCertificate (content As RequestContent, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional context As RequestContext = Nothing) As Response
Parameters
- content
- RequestContent
The content to send as the body of the request.
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 CreateCertificate.
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 = client.CreateCertificate(content);
Console.WriteLine(response.Status);