Community写作与编辑github.com

microsoft/azure-kusto-irql

通过可组合的IRQL函数管道,将自然语言的安全狩猎问题转化为Kusto查询,支持事件响应、威胁狩猎等场景。

azure-kusto-irql 是什么?

IRQL(事件响应查询语言)是基于KQL的函数式查询层,旨在简化网络安全调查中的Kusto查询编写。该技能允许用户通过组合 `Get_*`(选择器)、`Extract_*`(提取器)和 `Enrich_*`(丰富器)函数来构建复杂的狩猎管道,无需记忆底层数据模式或集群位置。它支持多个安全场景,如暴力破解检测、钓鱼邮件分析、后渗透取证和可疑外部IP身份验证异常分析。IRQL函数必须预先部署在目标Kusto数据库上,用户可通过验证 `.show functions` 确保其可用性。该技能适用于Claude Code、Cursor等AI编码代理,并提供直接的KQL输出,同时可选地支持通过Kusto Explorer打开查询。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/microsoft/agent-skills/tree/main/.github/plugins/azure-kusto-graph-skills/skills/azure-kusto-irql

Installed? Explore more 写作与编辑 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

IRQL —— 事件响应查询语言

从选择器、提取器和丰富器构建块中组合IRQL函数管道。IRQL将原始的KQL安全表包装在意图明确、可组合的函数背后,使分析人员(以及LLM)无需记忆模式、集群位置或连接键即可表达狩猎意图。

激活触发器

当用户出现以下情况时使用此技能:

  • 明确提及IRQL、Get_*、Extract_* 或 Enrich_* 函数
  • 说“使用IRQL”或“写一个IRQL查询”
  • 请求使用已知IRQL选择器构建可组合的狩猎管道

不要 为通用的安全查询(例如“查找失败的登录”)激活此技能,除非用户明确要求使用IRQL。请将这些查询路由到 azure-kusto。

不是自然语言到IRQL的转换器。 此技能负责组合IRQL函数管道,并可处理直接映射到已知选择器和简单过滤器的基本自然语言请求。对于通用的NL到KQL或NL到IRQL转换,请使用专用的查询生成技能(可单独获取)。

IRQL函数预检

在生成管道之前,验证目标数据库上是否可用IRQL:

.show functions
| where Name startswith "Get_" or Name startswith "Extract_" or Name startswith "Enrich_"
| project Name

如果未找到IRQL函数,请告知用户IRQL未部署到目标数据库,并建议改用 azure-kusto 进行原始KQL查询。IRQL函数是前提条件——此技能不会部署基础IRQL选择器。

IRQL是什么

IRQL是基于KQL的函数式方言。它提供:

  1. 统一模式 —— 不同的安全表映射到一致的列名,无论底层数据源如何
  2. 可组合性 —— 小函数通过 | invoke 链接,从简单步骤构建复杂狩猎
  3. 可移植性 —— 相同的IRQL管道可在不同集群/数据库上工作;只需重新指向 Get_* 原语

IRQL不是一种单独的语言。它是你可以调用的KQL函数。任何有效的KQL都可以与IRQL函数一起使用。

部署IRQL

IRQL函数是存储的KQL函数(.create-or-alter function)。它们必须已部署到目标数据库,此技能才能生成管道。

公共示例集群(函数预部署):

  • 集群:https://kc7001.eastus.kusto.windows.net
  • 数据库:ValdyTimes、JoJosHospital

要将IRQL移植到新的集群/数据库,请创建 Get_* 选择器,将源表投影到统一模式(列名如下),然后部署提取器和丰富器。只要输入模式匹配,提取器和丰富器无需修改即可工作。

函数目录

1. 选择器 —— Get_*

返回已投影、模式统一的源表视图。默认使用最小形式;需要额外列时使用 _All。

函数列
Get_Event_AuthenticationEnvTime、Hostname、ClientIp、Username、Result
Get_Event_Authentication_All+ Description、UserAgent、PasswordHash
Get_EmailEnvTime、EmailSender、EmailRecipient、Subject、Url
Get_Email_All+ ReplyTo、Verdict
Get_EmployeesName、ClientIp、Email、Username、Hostname、Role
Get_Employees_All+ HireDate、UserAgent、Domain
Get_Event_FileCreationEnvTime、Hostname、Filename、Path
Get_Event_FileCreation_All+ Username、Sha256、ProcessName
Get_Event_NetworkInboundEnvTime、ClientIp、Url
Get_Event_NetworkInbound_All+ Method、UserAgent、StatusCode
Get_Event_NetworkOutboundEnvTime、ClientIp、Url
Get_Event_NetworkOutbound_All+ Method、UserAgent
Get_Dns_AllEnvTime、Domain、ClientIp
Get_Event_ProcessEnvTime、ProcessCommandLine、ProcessName、Hostname、Username
Get_Event_Process_All+ ParentProcessName、ParentProcessHash、ProcessHash
Get_SecurityAlerts_AllEnvTime、AlertType、Severity、Description、Indicators
Get_Network_Connection_AllEnvTime、SourceIp、SourcePort、DestinationIp、DestinationPort、Protocol、Bytes

2. 提取器 —— Extract_*

从现有列派生新列。在选择器之后调用。

函数输入列新增列
Extract_Email_Sender_Domain(T)EmailSenderDomain
Extract_Employee_Firstname(T)NameFirstname
Extract_Event_Network_Domain(T)UrlDomainName

3. 丰富器 —— Enrich_*

左连接辅助函数,从相关表附加上下文信息。

函数键列丰富内容
Enrich_Event_Authentication_Username(T)Username用户的身份验证事件
Enrich_Ip_Employee(T)ClientIp基于IP的员工身份
Enrich_Username_Employee(T)Username基于用户名的员工身份
Enrich_Ip_Domain(T)ClientIp解析到IP的DNS域名
Enrich_Ip_Event_NetworkOutbound(T)ClientIp来自IP的出站网络
Enrich_Ip_Network_Connection(T)ClientIp来自IP的网络流

4. 外部丰富

函数来源要求
Enrich_Sha256_VirusTotal(T)VirusTotal文件报告API密钥 + 回调策略
Get_CISA_KEV() / Enrich_CISA_KEV(T)CISA KEV目录回调策略

组合规则

选择器 -> 提取 -> 过滤 -> 丰富 -> 汇总/投影
  1. 以选择器开头:Get_Event_Authentication、Get_Email 等。
  2. 提取 派生字段:| invoke Extract_Email_Sender_Domain()
  3. 过滤 出信号:| where Result == "Failed Login"
  4. 丰富 上下文:| invoke Enrich_Username_Employee()
  5. 汇总 / 投影 答案

始终在步骤之间使用管道符(|)。提取器和丰富器使用 | invoke FunctionName()。

查询生成指南

  • 除非需要额外列,否则使用最小选择器 -> 然后使用 _All
  • 在丰富器之前链接提取器(提取器添加丰富器可能依赖的列)
  • 尽可能早地放置 where 过滤器
  • 使用 summarize 进行聚合,使用 project 进行最终列选择
  • 以 order by + take 结束以限制输出

示例

有关更多提示和完整示例,请参见 references/EXAMPLES.md。

暴力破解检测

Get_Event_Authentication
| where Result == "Failed Login"
| summarize FailedCount = count() by Username
| where FailedCount > 19
| invoke Enrich_Username_Employee()
| project Username, Name, Role, Email, FailedCount
| order by FailedCount desc

按收件人级别进行钓鱼分类

Get_Email
| invoke Extract_Email_Sender_Domain()
| project EnvTime, EmailSender, Domain, Username = EmailRecipient, Subject, Url
| invoke Enrich_Username_Employee()
| extend Seniority = case(
    Role has_any ("CEO", "Chief", "Director", "VP", "President"), 3,
    Role has_any ("Manager", "Lead", "Senior"), 2,
    1)
| summarize
    TotalEmails = count(),
    SeniorityScore = sum(Seniority),
    Recipients = make_set(Name, 50),
    DistinctRecipients = dcount(Username)
  by Domain
| where DistinctRecipients >= 2
| order by SeniorityScore desc
| take 20

从指标进行后渗透横向

let victims =
    Get_Event_FileCreation_All
    | where Filename has "<INDICATOR>"
    | distinct Hostname;
Get_Event_Process
| where Hostname in (victims)
| where ProcessCommandLine has_any ("rundll32", "regsvr32", "powershell", "systeminfo")
| project EnvTime, Hostname, Username, ProcessName, ProcessCommandLine
| order by EnvTime asc

结合身份信息的可疑出站流量

Get_Event_NetworkOutbound
| invoke Extract_Event_Network_Domain()
| where DomainName has_any ("<SUSPICIOUS_DOMAIN_1>", "<SUSPICIOUS_DOMAIN_2>")
| invoke Enrich_Ip_Employee()
| project EnvTime, Name, Role, DomainName, Url, ClientIp
| order by EnvTime desc

外部IP身份验证异常

Get_Event_Authentication_All
| where not(ClientIp startswith "10.") and not(ClientIp startswith "192.168.")
| summarize
    Attempts = count(),
    Failures = countif(Result == "Failed Login"),
    Users = make_set(Username)
  by ClientIp
| order by Failures desc
| take 20

使用的MCP工具

工具用途
kusto_query在Kusto数据库上执行IRQL管道
kusto_table_schema_get发现可用的表和列
kusto_cluster_list列出可用的ADX集群
kusto_database_list列出集群中的数据库

在Kusto Explorer中打开查询(仅限Windows)

可选便捷功能。 默认工作流是在聊天中输出KQL,让用户手动复制到Kusto Explorer或VS Code Kusto扩展中。自动启动仅为选择加入。

始终在聊天响应中输出完整的KQL查询,并明确标记步骤1(连接)和步骤2(查询):

// 步骤1:连接到集群(如果已连接,请跳过)
// 示例:取消注释以连接到KC7训练集群
// #connect cluster('kc7001.eastus.kusto.windows.net').database('ValdyTimes')
// 或替换为您自己的集群:
// #connect cluster('<YOUR_CLUSTER>').database('<YOUR_DATABASE>')

// 步骤2:运行以下查询
<KQL_QUERY>

如果用户要求保存或在Kusto Explorer中打开,请按照 references/KUSTO_EXPLORER_LAUNCH.md 中的步骤操作。关键规则:

  • 在写入文件或启动可执行文件之前,使用 ask_user 进行确认
  • 在聊天中显示文件内容,以便用户在打开之前查看
  • 绝不使用shell插值或here-string——通过 Set-Content/Add-Content 写入文件
  • 绝不将查询编码到浏览器URL中
  • 在macOS/Linux上,保存 .kql 文件,并建议使用VS Code Kusto扩展或ADX Web Explorer
  • 关于IRQL数据的图形可视化,请参见 azure-kusto-graph 和 azure-kusto-irql-graph

Individual skills in this repo

This repo contains 12 individual skills — each has its own dedicated page.

microsoft/azure-ai-agents-persistent-dotnet

Azure AI Agents Persistent SDK for .NET. Low-level SDK for creating and managing AI agents with threads, messages, runs, and tools. Use for agent CRUD, conversation threads, streaming responses, function calling, file search, and code interpreter. Triggers: "PersistentAgentsClient", "persistent agents", "agent threads", "agent runs", "streaming agents", "function calling agents .NET".

microsoft/azure-ai-document-intelligence-dotnet

Azure AI Document Intelligence SDK for .NET. Extract text, tables, and structured data from documents using prebuilt and custom models. Use for invoice processing, receipt extraction, ID document analysis, and custom document models. Triggers: "Document Intelligence", "DocumentIntelligenceClient", "form recognizer", "invoice extraction", "receipt OCR", "document analysis .NET".

microsoft/azure-ai-openai-dotnet

Azure OpenAI SDK for .NET. Client library for Azure OpenAI and OpenAI services. Use for chat completions, embeddings, image generation, audio transcription, and assistants. Triggers: "Azure OpenAI", "AzureOpenAIClient", "ChatClient", "chat completions .NET", "GPT-4", "embeddings", "DALL-E", "Whisper", "OpenAI .NET".

microsoft/azure-ai-projects-dotnet

Azure AI Projects SDK for .NET. High-level client for Azure AI Foundry projects including agents, connections, datasets, deployments, evaluations, and indexes. Use for AI Foundry project management, versioned agents, and orchestration. Triggers: "AI Projects", "AIProjectClient", "Foundry project", "versioned agents", "evaluations", "datasets", "connections", "deployments .NET".

microsoft/azure-ai-voicelive-dotnet

Azure AI Voice Live SDK for .NET. Build real-time voice AI applications with bidirectional WebSocket communication. Use for voice assistants, conversational AI, real-time speech-to-speech, and voice-enabled chatbots. Triggers: "voice live", "real-time voice", "VoiceLiveClient", "VoiceLiveSession", "voice assistant .NET", "bidirectional audio", "speech-to-speech".

microsoft/azure-eventgrid-dotnet

Azure Event Grid SDK for .NET. Client library for publishing and consuming events with Azure Event Grid. Use for event-driven architectures, pub/sub messaging, CloudEvents, and EventGridEvents. Triggers: "Event Grid", "EventGridPublisherClient", "CloudEvent", "EventGridEvent", "publish events .NET", "event-driven", "pub/sub".

microsoft/azure-eventhub-dotnet

Azure Event Hubs SDK for .NET. Use for high-throughput event streaming: sending events (EventHubProducerClient, EventHubBufferedProducerClient), receiving events (EventProcessorClient with checkpointing), partition management, and real-time data ingestion. Triggers: "Event Hubs", "event streaming", "EventHubProducerClient", "EventProcessorClient", "send events", "receive events", "checkpointing", "partition".

microsoft/azure-identity-dotnet

Azure Identity library for .NET. Authentication library for Azure SDK clients using Microsoft Entra ID. Use for DefaultAzureCredential, managed identity, service principals, and developer credentials. Triggers: "Azure Identity", "DefaultAzureCredential", "ManagedIdentityCredential", "ClientSecretCredential", "authentication .NET", "Azure auth", "credential chain".

microsoft/azure-kusto-graph

Build and query Kusto graphs from natural language. Covers transient graphs (make-graph), persistent graph models/snapshots, pattern matching (graph-match), shortest paths, connected components, and graph-to-table export. Generates the edges-first thinking: define edges, define node lookups, union, make-graph. WHEN: make-graph, graph-match, graph-shortest-paths, graph-to-table, graph-mark-components, persistent graph, graph model, graph snapshot, build a graph from data, find paths between nodes, pattern matching in graph, connected components, transient graph, Kusto graph, KQL graph.

microsoft/azure-kusto-irql-graph

Apply IRQL graph functions to KQL or IRQL query results for Kusto Explorer visualization. Generates Lift_To_Graph mappings and composes Graph_Render_View, Graph_Fold_By_Property, Extract_Node_*, Enrich_Node_*, and Enrich_Graph_* calls. Accepts a supplied query or limited basic natural-language source request; it is not a general natural-language-to-KQL/IRQL skill. WHEN: Lift_To_Graph, Graph_Render_View, Graph_Fold_By_Property, IRQL graph enrichment, graph mapping for existing query results, icon-decorated graph, fold graph nodes. Use azure-kusto-graph for native make-graph analysis, graph-match, shortest paths, components, or persistent graphs.

microsoft/azure-local

Plan, deploy, operate, and troubleshoot Azure Local (formerly Azure Stack HCI): sizing and prerequisites, Arc registration, lifecycle updates, workloads (Azure Local VMs, AKS on Azure Local, images, disks, logical networks), SDN and network security, and failure triage — starting read-only and confirming before risky changes. WHEN: Azure Local, Azure Stack HCI, Arc resource bridge, custom location, Azure Local VM, Arc VM, AKS on Azure Local, AKS hybrid, SDN, Lifecycle Manager, Azure Local update, disconnected site.

microsoft/azure-local-multi-rack

Plan, deploy, operate, and troubleshoot multi-rack (rack scale) deployments of Azure Local — preintegrated racks scaling to hundreds of machines, built on Network Fabric Controller, Cluster Manager, SAN storage, and managed network fabric. Use for the Microsoft.NetworkCloud and Microsoft.ManagedNetworkFabric control plane. NOT for standard 1-16 node Azure Local, and NOT for rack-aware clusters (two racks as availability zones, up to 8 nodes, synchronous replication) — those are standard scale. WHEN: multi-rack, rack scale Azure Local, aggregation rack, compute rack, Network Fabric Controller, NFC, Cluster Manager, network fabric, isolation domain, az networkcloud, az networkfabric, multi-rack logical network, multi-rack Arc VM.

相关技能