资源和资源组的 Azure 工作簿参数
我被 Kusto 击败了,我认为这是一个简单的查询...... 我正在制作我的第一本工作簿并使用参数。我可以列出并选择一个资源组,但当选择多个资源组时,我无法使用虚拟机填充以下参数(虚拟机)。 ResourceGroup
将逗号分隔的组名称字符串作为属性 resourcegroup
传递就可以了。我不知道如何将该字符串转换为可用的 where 语句。当我手动将多个资源组串在一起时,我的查询工作得很好,因此我认为我对 Kusto 中的 let
和数组的理解感到困惑。如果有更好的方法来做我想做的事情,请告诉我。
//This will work so long as 1 Resource Group is passed from the previous parameter
resources
| where resourceGroup in ('{ResourceGroup:resourcegroup}') and type =~ microsoft.compute/virtualmachines'
| project value = id , label = name
我发现我可以使用 split('{ResourceGroup:resourcegroup}',",") 获得一个正确的数组,但是,我再次无法将该对象与where 语句。
非常感谢任何帮助!
I've been defeated by Kusto on what I thought to be a simple query...
I'm making my first workbook and playing with parameters. I can list and select a Resource Group, but I can't make the following parameter (Virtual Machines) populate with the VMs when more than one Resource Group is selected. The ResourceGroup
passes a comma delineated string of the group names as a property resourcegroup
just fine. I cannot figure out how to translate that string into a usable where-statement. My query works just fine when I manually string several Resource Groups together so I assume I'm getting burned by my understanding of let
and arrays in Kusto. If there is a better way of doing what I'm trying to do, please let me know.
//This will work so long as 1 Resource Group is passed from the previous parameter
resources
| where resourceGroup in ('{ResourceGroup:resourcegroup}') and type =~ microsoft.compute/virtualmachines'
| project value = id , label = name
I've figured out I can get a proper array with split('{ResourceGroup:resourcegroup}',",")
, but, again, I haven't been able to marry up that object with a where-statement.
Any help is much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 https:// /github.com/microsoft/Application-Insights-Workbooks/blob/master/Documentation/Parameters/DropDown.md#special-casing-all
通常有一种方法可以做到这一点:
但是,我认为Azure Resource Graph不允许以这种方式使用
let
?如果您收到不允许
let
的错误,则必须内联执行几次动态操作:in https://github.com/microsoft/Application-Insights-Workbooks/blob/master/Documentation/Parameters/DropDown.md#special-casing-all
NORMALLY there is a way to do this:
however, i don't think Azure Resource Graph allows using
let
this way?if you get an error that
let
isn't allowed, you'll have to do that dynamic thing inline a couple times instead:我相信这是实现这一目标的最简单方法 - 通过资源组参数进行过滤:
|其中 iff(resourceGroup =~ '{ResourceGroup:resourcegroup}', true, false)
这似乎是类型的一些问题,并且如果没有 iif 函数,它似乎不会将结果视为 bool。
I believe this is the easiest way to achieve just that - filtering by the resource group param:
| where iff(resourceGroup =~ '{ResourceGroup:resourcegroup}', true, false)
It seems to be some issue with the types, and without the iif function it doesn't seem to consider the result as bool.