如何在Kusto中​​使用动态关键字

时间:2019-07-20 01:57:43

标签: kusto

我正在使用Azure资源图,该资源图使用Kusto语言查询Azure资源,并且困惑如何通过dynamic关键字从现有对象中创建自己的对象。下面的示例显示了我正在尝试仅将disk的相同值分配给动态对象osDisk,但是它失败,并显示InvalidQuery。我在做什么错了?

where type =~ 'Microsoft.Compute/virtualmachines' 
| extend disk = properties.storageProfile.osDisk 
| extend osDisk = dynamic({"osdisk" : properties.storageProfile.osDisk})
|project disk, osDisk

错误

Please provide below info when asking for support: timestamp = 2019-07-20T01:55:46.6283092Z, correlationId = 297ad2ed-81f2-49b3-86b2-5f38e2394923. (Code: BadRequest) Query is invalid. Please refer to the documentation for the Azure Resource Graph service and fix the error before retrying. (Code: InvalidQuery)

删除dynamic行选项可以正确返回结果

1 个答案:

答案 0 :(得分:0)

尝试使用pack()https://docs.microsoft.com/en-us/azure/kusto/query/packfunction

print disk = "disk_value", properties = dynamic({"storageProfile":{"osDisk":"osDisk_value"}})
| project disk,  osDisk = pack("osDisk", properties.storageProfile.osDisk)