How to run a purge command in ADX using ADF?

Sailesh Choyal 0 Reputation points
2024-06-12T18:37:13.4033333+00:00

Approach 1

Created an ADX activity in ADF, and in the command field, I wrote the purge command (which I copied from Azure Docs): .purge table MyTable in database DBName allrecords

I tried running the purge command but it keeps returning syntax error: BadRequest_SyntaxError: Request is invalid and cannot be executed

Approach 2

Created a Web Activity in ADF, where I used a Linked Service, and set the following config:

Base URL as the URI of the Kusto cluster: https://<clusterName>.<region>.kusto.windows.net Authentication: System Assigned Managed Identity
Resource: https://<clusterName>.<region>.kusto.windows.net (URI of the Kusto cluster)
Relative URL: v1/rest/mgmt
Method: POST
Body:
{
"db" : "DBName",
"csl" : ".purge table MyTable in database DBName allrecords"
}


But it also returns the same error: BadRequest_SyntaxError: Request is invalid and cannot be executed

The user/role has Admin privielges to the cluster and Purge is enabled from the ADX config.

Note that I'm not using the ingest- endpoint here to run purge because I couldn't get it to work and there isn't info available in the docs as to where to put the ingest- endpoint URL.

Azure Data Explorer
Azure Data Explorer
An Azure data analytics service for real-time analysis on large volumes of data streaming from sources including applications, websites, and internet of things devices.
501 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,978 questions
{count} votes