Search code examples
azure-data-factoryazure-data-explorerkql

How to use ADF parameters in a Kusto command activity?


I would like to use an ADF parameter as a value inside my Kusto query in the command tab.

If I use the value percentage cpu manually in my query, it will run just fine.

KustoTable
| where tolower(CounterName) has "percentage cpu"

But if I change my query to this one below, nothing happens.

What is the proper way to use Kusto command + parameters?

KustoTable
| where tolower(CounterName) has "{counter}"

Solution

  • Parameter should be given as "@{pipeline().parameters.<parameter-name>}" in Kusto Query.

    KustoTable
    | where tolower(CounterName) has "@{pipeline().parameters.counter}"
    

    I tried this with sample query. Below are the steps.

    • Parameter named counter is created in ADF pipeline.

    enter image description here

    • Then in query or command text box, add dynamic content is clicked and sample query is typed in the text box.

    sample query:

    .show tables
    | where TableName has "@{pipeline().parameters.counter}"
    

    enter image description here

    When pipeline is run, it got executed successfully.