gpt4 book ai didi

azure - KQL::查找名称类似于 "_old"的 Azure SQL 数据库

转载 作者:行者123 更新时间:2023-12-03 02:10:28 28 4
gpt4 key购买 nike

我是 KQL 新手,我正在尝试列出名称中包含“_old”一词的所有 Azure SQL 数据库。

我的原型(prototype)查询是这样的并且它有效:

// Find "_old" Databases
Resources
| where type =~ 'microsoft.sql/servers/databases'
| where * contains "old"
| project resourceName = name,type,sku.name,sku.tier,tags.createdBy,tags.customerCode,tags.managedBy, resourceGroup, subscriptionId, location

但是这里的 WHERE 子句在所有列中的任何地方都被轰炸。

是否有更时尚的方式来搜索 Azure,理想情况下使用更多单词,例如:

  • _旧
  • .旧
  • _测试
  • .测试
  • _dev
  • .dev

我必须清理未使用的资源,并且必须搜索每个资源名称。

最佳答案

  • 目前,Azure Resource Graph 支持相当有限的 KQL 子集。例如。目前不支持 has_any
  • 如果需要,您可以取消注释行以提高性能。
<小时/>
Resources
| where type == 'microsoft.sql/servers/databases'
// | where name has_cs "old" or name has_cs "dev" or name has_cs "test"
| parse-where kind=regex name with ".*[._]" suffix
| where suffix in ("old", "dev", "test")

关于azure - KQL::查找名称类似于 "_old"的 Azure SQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73484589/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com