skolukmar
skolukmar

Reputation: 331

KQL Kusto: Result of table management command as an input

I am going to create a policy update by takeing policy defintion from another table. Let's assume, we have a sampleTable table with the following definition:

.alter table sampleTable policy update @'[{"Source": "sourceTable", "Query": "function()", "IsEnabled": "True", "IsTransactional": false}]';

I would like to use policy for a newTable which were used for sampleTable. I have tried to do something like below:

let definition = (.show table sampleTable policy update | project Policy);
.alter table sampleTable policy update definition ;

I deeply belive, that it is doable, but I don't know the syntax here.

Could you please support me?

Upvotes: 2

Views: 465

Answers (1)

Yoni L.
Yoni L.

Reputation: 25995

  1. a control command must start with a dot (.): https://stackoverflow.com/a/55387571/7861807

  2. you need to explicitly specify the policy as a string literal. you can't base it on a result of a different query/command.

  3. you can orchestrate this programmatically using the API - run a command to get the policy definition (as a string), then generate the following command using that string, then invoke the generated command.

Upvotes: 1

Related Questions