building-cloud-siem-with-sentinel

本 skill 涵盖将 Microsoft Sentinel 部署为云原生 SIEM 和 SOAR 平台以实现集中安全运营。 详细介绍为多云日志摄入配置数据连接器、编写 KQL 检测查询、使用 Logic Apps 构建自动化响应手册, 以及利用 Sentinel 数据湖对 AWS、Azure 和 GCP 安全遥测进行 PB 级威胁狩猎。

9 stars

Best use case

building-cloud-siem-with-sentinel is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

本 skill 涵盖将 Microsoft Sentinel 部署为云原生 SIEM 和 SOAR 平台以实现集中安全运营。 详细介绍为多云日志摄入配置数据连接器、编写 KQL 检测查询、使用 Logic Apps 构建自动化响应手册, 以及利用 Sentinel 数据湖对 AWS、Azure 和 GCP 安全遥测进行 PB 级威胁狩猎。

Teams using building-cloud-siem-with-sentinel should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/building-cloud-siem-with-sentinel/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/building-cloud-siem-with-sentinel/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/building-cloud-siem-with-sentinel/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How building-cloud-siem-with-sentinel Compares

Feature / Agentbuilding-cloud-siem-with-sentinelStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

本 skill 涵盖将 Microsoft Sentinel 部署为云原生 SIEM 和 SOAR 平台以实现集中安全运营。 详细介绍为多云日志摄入配置数据连接器、编写 KQL 检测查询、使用 Logic Apps 构建自动化响应手册, 以及利用 Sentinel 数据湖对 AWS、Azure 和 GCP 安全遥测进行 PB 级威胁狩猎。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 使用 Sentinel 构建云 SIEM

## 适用场景

- 为多云环境建立集中式安全运营中心时
- 从传统 SIEM 平台(Splunk、QRadar)迁移到云原生架构时
- 为云特定威胁构建自动化事件响应工作流时
- 对 PB 级安全遥测数据进行大规模威胁狩猎时
- 将威胁情报源与云安全日志分析集成时

**不适用于**:AWS 独立环境(Security Hub 和 GuardDuty 已足够)、需要 EDR 能力的终端检测(使用 Defender for Endpoint),或合规态势监控(参见 building-cloud-security-posture-management)。

## 前置条件

- 在 Log Analytics 工作区上启用 Microsoft Sentinel 的 Azure 订阅
- 目标日志源(AWS CloudTrail、Azure Activity、GCP)的数据连接器权限
- Logic Apps 或 Azure Functions,用于自动化响应手册
- KQL(Kusto Query Language)熟练度,用于编写检测规则和狩猎查询

## 工作流程

### 步骤 1:配置 Sentinel 工作区和数据连接器

创建针对安全数据优化的 Log Analytics 工作区,并启用多云摄入的数据连接器。

```powershell
# 创建 Log Analytics 工作区
az monitor log-analytics workspace create \
  --resource-group security-rg \
  --workspace-name sentinel-workspace \
  --location eastus \
  --retention-time 365 \
  --sku PerGB2018

# 在工作区上启用 Microsoft Sentinel
az sentinel onboarding-state create \
  --resource-group security-rg \
  --workspace-name sentinel-workspace

# 启用 AWS CloudTrail 连接器
az sentinel data-connector create \
  --resource-group security-rg \
  --workspace-name sentinel-workspace \
  --data-connector-id aws-cloudtrail \
  --kind AmazonWebServicesCloudTrail \
  --aws-cloud-trail-data-connector '{
    "awsRoleArn": "arn:aws:iam::123456789012:role/SentinelCloudTrailRole",
    "dataTypes": {"logs": {"state": "Enabled"}}
  }'

# 启用 Azure AD 登录和审计日志
az sentinel data-connector create \
  --resource-group security-rg \
  --workspace-name sentinel-workspace \
  --data-connector-id azure-ad \
  --kind AzureActiveDirectory \
  --azure-active-directory '{
    "dataTypes": {
      "alerts": {"state": "Enabled"},
      "signinLogs": {"state": "Enabled"},
      "auditLogs": {"state": "Enabled"}
    }
  }'
```

### 步骤 2:编写 KQL 检测规则

使用 Kusto Query Language 创建分析规则以检测云特定威胁。将每条规则映射到 MITRE ATT&CK 技术。

```kql
// 检测不可能的旅行 - 来自地理位置遥远处的登录
let timeframe = 1h;
let distance_threshold = 500; // 千米
SigninLogs
| where TimeGenerated > ago(timeframe)
| where ResultType == 0 // 仅成功登录
| project TimeGenerated, UserPrincipalName, IPAddress, Location,
          Latitude = toreal(LocationDetails.geoCoordinates.latitude),
          Longitude = toreal(LocationDetails.geoCoordinates.longitude)
| sort by UserPrincipalName asc, TimeGenerated asc
| extend PrevLatitude = prev(Latitude, 1), PrevLongitude = prev(Longitude, 1),
         PrevTime = prev(TimeGenerated, 1), PrevUser = prev(UserPrincipalName, 1)
| where UserPrincipalName == PrevUser
| extend TimeDiff = datetime_diff('minute', TimeGenerated, PrevTime)
| where TimeDiff < 60
| extend Distance = geo_distance_2points(Longitude, Latitude, PrevLongitude, PrevLatitude) / 1000
| where Distance > distance_threshold
| project TimeGenerated, UserPrincipalName, IPAddress, Location, Distance, TimeDiff
```

```kql
// 检测 CloudTrail 中的 AWS IAM 凭据滥用
AWSCloudTrail
| where TimeGenerated > ago(24h)
| where EventName in ("ConsoleLogin", "AssumeRole", "GetSessionToken")
| where ErrorCode == ""
| summarize LoginCount = count(), DistinctIPs = dcount(SourceIpAddress),
            IPList = make_set(SourceIpAddress, 10)
            by UserIdentityArn, bin(TimeGenerated, 1h)
| where DistinctIPs > 3
| project TimeGenerated, UserIdentityArn, LoginCount, DistinctIPs, IPList
```

```kql
// 检测 S3 对象批量删除(潜在勒索软件)
AWSCloudTrail
| where TimeGenerated > ago(1h)
| where EventName == "DeleteObject" or EventName == "DeleteObjects"
| summarize DeleteCount = count(), BucketsAffected = dcount(RequestParameters_bucketName)
            by UserIdentityArn, bin(TimeGenerated, 10m)
| where DeleteCount > 100
| project TimeGenerated, UserIdentityArn, DeleteCount, BucketsAffected
```

### 步骤 3:使用 Logic Apps 构建 SOAR 手册

创建当分析规则触发事件时执行的自动化响应手册。常见操作包括封锁用户、隔离资源和用威胁情报丰富告警。

```json
{
  "definition": {
    "triggers": {
      "Microsoft_Sentinel_incident": {
        "type": "ApiConnectionWebhook",
        "inputs": {
          "body": {"incidentArmId": "subscriptions/@{triggerBody()?['workspaceInfo']?['SubscriptionId']}/resourceGroups/@{triggerBody()?['workspaceInfo']?['ResourceGroupName']}/providers/Microsoft.OperationalInsights/workspaces/@{triggerBody()?['workspaceInfo']?['WorkspaceName']}/providers/Microsoft.SecurityInsights/Incidents/@{triggerBody()?['object']?['properties']?['incidentNumber']}"},
          "host": {"connection": {"name": "@parameters('$connections')['microsoftsentinel']['connectionId']"}}
        }
      }
    },
    "actions": {
      "Get_incident_entities": {
        "type": "ApiConnection",
        "inputs": {"method": "post", "path": "/Incidents/entities"}
      },
      "For_each_account_entity": {
        "type": "Foreach",
        "foreach": "@body('Get_incident_entities')?['Accounts']",
        "actions": {
          "Disable_Azure_AD_user": {
            "type": "ApiConnection",
            "inputs": {
              "method": "PATCH",
              "path": "/v1.0/users/@{items('For_each_account_entity')?['AadUserId']}",
              "body": {"accountEnabled": false}
            }
          },
          "Add_comment_to_incident": {
            "type": "ApiConnection",
            "inputs": {
              "body": {"message": "用户 @{items('For_each_account_entity')?['Name']} 已由自动化手册禁用"}
            }
          }
        }
      }
    }
  }
}
```

### 步骤 4:配置 Sentinel 数据湖用于长期狩猎

启用 Sentinel 数据湖以实现 PB 级日志保留,并使用 KQL 和 SQL 端点进行高级威胁狩猎。

```kql
// 威胁狩猎查询:检测跨 AWS 账户的横向移动
let suspicious_roles = AWSCloudTrail
| where TimeGenerated > ago(7d)
| where EventName == "AssumeRole"
| extend AssumedRoleArn = tostring(parse_json(RequestParameters).roleArn)
| where AssumedRoleArn contains "cross-account" or AssumedRoleArn contains "admin"
| summarize AssumeCount = count(), UniqueSourceAccounts = dcount(RecipientAccountId)
            by UserIdentityArn, AssumedRoleArn
| where AssumeCount > 10 and UniqueSourceAccounts > 2;
suspicious_roles
| join kind=inner (
    AWSCloudTrail
    | where TimeGenerated > ago(7d)
    | where EventName in ("RunInstances", "CreateFunction", "PutBucketPolicy")
) on UserIdentityArn
| project TimeGenerated, UserIdentityArn, AssumedRoleArn, EventName, SourceIpAddress
```

### 步骤 5:集成威胁情报

连接威胁情报提供商,创建基于指标的匹配规则,检测与已知恶意基础设施的通信。

```powershell
# 启用 Microsoft 威胁情报连接器
az sentinel data-connector create \
  --resource-group security-rg \
  --workspace-name sentinel-workspace \
  --data-connector-id microsoft-ti \
  --kind MicrosoftThreatIntelligence \
  --microsoft-threat-intelligence '{
    "dataTypes": {"microsoftEmergingThreatFeed": {"lookbackPeriod": "2025-01-01T00:00:00Z", "state": "Enabled"}}
  }'
```

```kql
// 将网络指标与云流日志匹配
let TI_IPs = ThreatIntelligenceIndicator
| where TimeGenerated > ago(30d)
| where isnotempty(NetworkIP)
| distinct NetworkIP;
AzureNetworkAnalytics_CL
| where TimeGenerated > ago(24h)
| where DestIP_s in (TI_IPs)
| project TimeGenerated, SrcIP_s, DestIP_s, DestPort_d, FlowType_s
```

## 核心概念

| 术语 | 定义 |
|------|------------|
| KQL | Kusto Query Language,Microsoft Sentinel 的主要查询语言,用于搜索、分析和可视化安全数据 |
| 分析规则(Analytics Rule) | Sentinel 中的检测逻辑,按计划评估日志数据,当条件匹配时创建事件 |
| SOAR 手册(SOAR Playbook) | 由事件触发的自动化工作流,执行响应操作,如封锁账户、丰富告警或通知团队 |
| 数据连接器(Data Connector) | 将来自云服务、身份提供商和第三方工具的安全日志摄入 Sentinel 的集成模块 |
| Sentinel 数据湖(Sentinel Data Lake) | PB 级存储层,提供长期日志保留,具有 KQL 和 SQL 查询接口用于高级狩猎 |
| 工作簿(Workbook) | Sentinel 中的交互式仪表板,显示安全数据、趋势和运营指标的可视化 |
| 监视列表(Watchlist) | Sentinel 中的参考数据表,用于通过 VIP 用户列表或已批准 IP 范围等上下文丰富告警 |
| Fusion 检测(Fusion Detection) | 机器学习驱动的关联引擎,自动检测跨数据源的多阶段攻击 |

## 工具与系统

- **Microsoft Sentinel**:基于 Azure Log Analytics 的云原生 SIEM/SOAR 平台,具备 AI 驱动的威胁检测
- **Azure Logic Apps**:低代码自动化平台,用于构建由 Sentinel 事件触发的 SOAR 手册
- **Microsoft Threat Intelligence**:集成的威胁情报源,提供 IP、域名和 URL 指标用于与安全日志匹配
- **Azure Data Explorer**:支撑 Sentinel KQL 查询的高性能分析引擎,用于大规模数据探索
- **MITRE ATT&CK Navigator**:将 Sentinel 检测规则映射到对手战术和技术的框架

## 常见场景

### 场景:检测跨云凭据盗窃活动

**场景背景**:攻击者通过钓鱼入侵 Azure AD 账户,然后使用该账户通过联合身份访问 AWS 资源。Sentinel 需要将 Azure 登录异常与异常 AWS API 活动相关联。

**方法**:
1. 创建检测 Azure AD 不可能旅行或异常登录风险的分析规则
2. 编写 KQL 查询,将被入侵的 Azure AD 身份与 AWS CloudTrail AssumeRoleWithSAML 事件相关联
3. 构建 Fusion 检测规则,将 Azure AD 风险事件与后续 AWS 权限提升活动关联
4. 部署 SOAR 手册,自动禁用 Azure AD 账户并撤销 AWS STS 会话
5. 创建工作簿,展示从初始入侵到 AWS 横向移动的时间线
6. 在数据湖上运行狩猎查询,检查是否有其他账户存在类似模式

**常见陷阱**:不跨云提供商关联身份会遗漏完整的攻击链。将分析规则频率设置太低(如 24 小时)会给攻击者留下数小时的未检测访问时间。

## 输出格式

```
Microsoft Sentinel SOC 运营报告
==========================================
工作区: sentinel-workspace
数据源: 14 个连接器活跃
报告周期: 2025-02-01 至 2025-02-23

数据摄入:
  Azure AD 登录日志:     2.3 TB(23 天)
  AWS CloudTrail:        1.8 TB(23 天)
  Azure Activity:        0.9 TB(23 天)
  Defender for Cloud 告警: 45 GB(23 天)
  总摄入量:              5.1 TB

检测摘要:
  活跃分析规则: 87 条
  创建事件: 234 个
    严重: 8 | 高: 34 | 中: 89 | 低: 103
  平均检测时间(MTTD): 4.2 分钟
  平均响应时间(MTTR): 18 分钟

主要事件类型:
  检测到不可能旅行:           42 个事件
  AWS 未授权 API 调用模式:    28 个事件
  S3 批量文件删除:             3 个事件
  可疑 Azure AD 应用注册:     12 个事件

自动化:
  执行手册: 156 次
  自动禁用账户: 23 个
  自动丰富事件: 198 个
  误报率: 12%
```

Related Skills

securing-kubernetes-on-cloud

9
from killvxk/cybersecurity-skills-zh

本技能涵盖通过实施 Pod 安全标准(Pod Security Standards)、网络策略、工作负载身份、RBAC 权限控制、镜像准入控制和运行时安全监控,对 EKS、AKS 和 GKE 上的托管 Kubernetes 集群进行加固。涉及云平台特定安全功能,包括 EKS 的 IRSA、GKE 的工作负载身份(Workload Identity)以及 AKS 的托管身份(Managed Identity)。

performing-threat-hunting-with-elastic-siem

9
from killvxk/cybersecurity-skills-zh

使用 KQL/EQL 查询、检测规则和 Timeline 调查在 Elastic Security SIEM 中执行主动威胁狩猎, 识别绕过自动检测的威胁。适用于 SOC 团队针对特定 ATT&CK 技术进行狩猎、调查异常行为, 或使用 Elasticsearch 和 Kibana Security 验证检测覆盖缺口。

performing-log-source-onboarding-in-siem

9
from killvxk/cybersecurity-skills-zh

在 SIEM 平台中执行结构化日志源接入,通过配置采集器、解析器、归一化和验证, 实现完整的安全可视化覆盖。

performing-false-positive-reduction-in-siem

9
from killvxk/cybersecurity-skills-zh

通过规则调优、阈值调整、关联细化和威胁情报丰富化,系统性地减少 SIEM 中的误报,以应对告警疲劳。

performing-cloud-storage-forensic-acquisition

9
from killvxk/cybersecurity-skills-zh

通过收集 API 远程数据和端点设备本地同步客户端制品,对 Google Drive、OneDrive、Dropbox 和 Box 等云存储服务执行取证获取和分析。

performing-cloud-penetration-testing

9
from killvxk/cybersecurity-skills-zh

对 AWS、Azure 和 GCP 云环境执行授权渗透测试,识别 IAM 错误配置、暴露的存储桶、过度宽松的安全组、 无服务器函数漏洞以及从初始访问到账户沦陷的云特定攻击路径。测试人员使用云原生工具及 Pacu、 ScoutSuite 等专用框架枚举并利用云基础设施。适用于云渗透测试、AWS 安全评估、Azure 渗透测试 或云基础设施安全测试等请求场景。

performing-cloud-penetration-testing-with-pacu

9
from killvxk/cybersecurity-skills-zh

使用开源 AWS 利用框架 Pacu 执行已授权的 AWS 渗透测试,枚举 IAM 配置、发现权限提升路径、测试凭据收集,并通过系统化的攻击模拟验证安全控制。

performing-cloud-native-forensics-with-falco

9
from killvxk/cybersecurity-skills-zh

使用 Falco YAML 规则在容器和 Kubernetes 中进行运行时威胁检测,监控系统调用以检测 shell 生成、文件篡改、网络异常和权限提升。通过 Falco gRPC API 管理 Falco 规则并解析 Falco 告警输出。适用于构建容器运行时安全或调查 k8s 集群入侵。

performing-cloud-incident-containment-procedures

9
from killvxk/cybersecurity-skills-zh

在 AWS、Azure 和 GCP 中执行云原生事件遏制,包括隔离受攻陷资源、撤销凭据、保全取证证据,以及应用安全组限制以防止横向移动。

performing-cloud-forensics-with-aws-cloudtrail

9
from killvxk/cybersecurity-skills-zh

使用 CloudTrail 日志对 AWS 环境执行取证调查,重建攻击者活动、识别受损凭据并分析 API 调用模式。

performing-cloud-forensics-investigation

9
from killvxk/cybersecurity-skills-zh

通过收集和分析来自 AWS、Azure 和 GCP 服务的日志、快照和元数据,在云环境中开展取证调查。

performing-cloud-asset-inventory-with-cartography

9
from killvxk/cybersecurity-skills-zh

使用 Cartography 执行全面的云资产清单和关系映射,在 AWS、GCP 和 Azure 中构建包含基础设施资产、IAM 权限和攻击路径的 Neo4j 安全图谱。