1

我正在使用 Azure Resource Graph,它使用 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行选项正确返回结果

4

1 回答 1

3

尝试使用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)
于 2019-07-20T02:09:47.073 回答