1

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your help. We got it work, but only with inline commands. With file commands it does not replace the variables. For file commands we use a task https://marketplace.visualstudio.com/items?itemName=SETISAS.replace-variables-in-file&targetId=a2fce0c8-108c-44f9-aab4-e7a2702c0d56 which replaces all the variables in artifact file and run it after replace. https://imgur.com/a/c4OalhN
Yes,it is. It seems like that variables in file command can't be parsed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.