.cancel operation command

Learn how to use the .cancel operation command to cancel a long-running operation.

This command cancels a long-running ingest from query operation. This command is useful when the operation is taking too long and you would like to abort it while running.

The cancel operation command isn’t guaranteed to succeed. The output of the .cancel operation command indicates whether or not cancellation was successful.

Syntax

.cancel operation OperationId [with ( reason = ReasonPhrase )]

Parameters

NameTypeRequiredDescription
OperationIdguid✔️A guid of the operation ID returned from the running command.
ReasonPhrasestringThe reason for canceling the running command.

Returns

Output parameterTypeDescription
OperationIdguidThe operation ID of the operation that was canceled.
OperationstringThe operation kind that was canceled.
StartedOndatetimeThe start time of the operation that was canceled.
CancellationStatestringReturns one of the following options:
Cancelled successfully: the operation was canceled
Cancel failed: the operation can’t be canceled at this point. The operation may still be running or may have completed.
ReasonPhrasestringReason why cancellation wasn’t successful.

Example

.cancel operation 078b2641-f10d-4694-96f8-1ee2b75dda48 with(Reason="Command canceled by me")
OperationIdOperationStartedOnCancellationStateReasonPhrase
c078b2641-f10d-4694-96f8-1ee2b75dda48TableSetOrAppend2022-07-18 09:03:55.1387320Canceled successfullyCommand canceled by me