Alessio
Alessio

Reputation: 55

How to pass Azure DevOps pipeline variable into command of 'Run Azure Data Explorer Command'

We use these Azure Kusto Command tasks: https://learn.microsoft.com/en-us/azure/data-explorer/devops

How can we pass variables into the kusto commands (like EventColdStorageConnectionString in the example)?

.create-or-alter external table EventData(['version']:string,messageid:string,serial:string,datetimelocal:datetime,datetimeutc:datetime,cspid:string,cspname:string,ownerid:string,ownername:string,location:string,countrycode:string,softwareversion:string,['configuration']:string,model:string,severityname:string,number:string,eventname:string,categoryname:string,stateful:bool,index:real,module:string,source:string,internaltext:string, fingerprint: long)
    kind = storage
    partition by (Model: string = model, Date: datetime = startofday (datetimeutc))
    pathformat = ('Events/' Model '/' datetime_pattern('yyyy/MM/dd', Date))
    dataformat = parquet
    (h@'$EventColdStorageConnectionString') --> insert variable here
    with (includeHeaders = 'None', folder = 'ColdStorage');

I've already tried to access variables like in powershell scripts.

Upvotes: 1

Views: 186

Answers (1)

Dou Xu-MSFT
Dou Xu-MSFT

Reputation: 3231

Please follow below steps:

1 define variable in pipeline define variable

2 use variable EventColdStorageConnectionString in your script Here is script sample:

    dataformat = parquet
    (
      h@'$(EventColdStorageConnectionString)'
     ) 

3 I test it in my pipeline and it can parse the variable EventColdStorageConnectionString successfully.

run result

Upvotes: 1

Related Questions