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

标签 azure kql azure-resource-graph

我是 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/

相关文章:

azure - 按 KQL 中的属性聚合数据

azure - 是否有一个查询可以运行,以便我可以获得过去 30 天内未登录的用户列表?

azure - 如何为 Azure Log Analytics REST API 提供查询参数

azure - 如何获取Azure机器学习和Azure Databricks下的计算实例大小列表?

ruby-on-rails - 如何连接到redis-rb中的集群Azure Redis缓存?

azure - 如何在 Azure Application Insights Analytics 上执行不同的操作,然后从新的不同集合中投影几个变量

Angular5部署到Azure webapp : Content Security Policy

Azure CLI - az 部署组创建 - SubscriptionNotAuthorizedForImage 错误

Azure 资源图浏览器结果已缓存?

azure - 获取 Azure 中所有服务主体的证书状态,例如证书是否无效,以及最终它们在 Azure 中连接到的内容