Share via


Certificate.DeleteAsync Method

Definition

Deletes the certificate from the Batch account.

public System.Threading.Tasks.Task DeleteAsync (System.Collections.Generic.IEnumerable<Microsoft.Azure.Batch.BatchClientBehavior> additionalBehaviors = default, System.Threading.CancellationToken cancellationToken = default);
member this.DeleteAsync : seq<Microsoft.Azure.Batch.BatchClientBehavior> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function DeleteAsync (Optional additionalBehaviors As IEnumerable(Of BatchClientBehavior) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

additionalBehaviors
IEnumerable<BatchClientBehavior>

A collection of BatchClientBehavior instances that are applied to the Batch service request after the CustomBehaviors.

cancellationToken
CancellationToken

A CancellationToken for controlling the lifetime of the asynchronous operation.

Returns

A Task that represents the asynchronous operation.

Remarks

The delete operation requests that the certificate be deleted. The request puts the certificate in the Deleting state. The Batch service will perform the actual certificate deletion without any further client action.

You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that:

  • The certificate is not associated with any pools.
  • The certificate is not installed on any compute nodes. (Even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart.)

If you try to delete a certificate that is in use, the deletion fails. The certificate state changes to DeleteFailed. You can use CancelDeleteAsync(IEnumerable<BatchClientBehavior>, CancellationToken) to set the status back to Active if you decide that you want to continue using the certificate.

The delete operation runs asynchronously.

Applies to