代码之家  ›  专栏  ›  技术社区  ›  Gregory Suvalian

如何在kusto中使用动态关键字

  •  0
  • Gregory Suvalian  · 技术社区  · 6 年前

    我正在使用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)
    

    去除 动态 line选项正确返回结果

    1 回复  |  直到 6 年前
        1
  •  0
  •   Yoni L.    6 年前

    试用使用 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)
    
    推荐文章