L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Productivité · SKILL.md

securing-azure-with-microsoft-defender

securing-azure-with-microsoft-defender

本技能指导安全从业者将 Microsoft Defender for Cloud 部署为 Azure、多云和混合环境的云原生应用保护平台(CNAPP)。涵盖为服务器、容器、存储和数据库启用 Defender 计划、配置安全建议、管理安全分数(Secure Score),以及与统一 Defender 门户集成进行集中威胁管理。

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: securing-azure-with-microsoft-defender description: > 本技能指导安全从业者将 Microsoft Defender for Cloud 部署为 Azure、多云和混合环境的云原生应用保护平台(CNAPP)。涵盖为服务器、容器、存储和数据库启用 Defender 计划、配置安全建议、管理安全分数(Secure Score),以及与统一 Defender 门户集成进行集中威胁管理。 domain: cybersecurity subdomain: cloud-security tags: [microsoft-defender, azure-security, cnapp, secure-score, cloud-workload-protection] version: 1.0.0 author: mahipal license: Apache-2.0

使用 Microsoft Defender 保护 Azure

适用场景

  • 在 Azure 订阅和资源组中部署云工作负载保护时
  • 建立安全分数(Secure Score)基线并确定安全建议优先级时
  • 将威胁保护扩展到包括 AWS 和 GCP 在内的多云环境时
  • 为 AKS 集群和 Azure Container Registry 启用容器安全时
  • 将 AI 工作负载安全与数据和 AI 安全仪表板集成时

不适用于:纯 AWS 环境(参见 implementing-aws-security-hub)、身份提供商配置(参见 managing-cloud-identity-with-okta),或网络层防火墙规则管理(参见 implementing-cloud-waf-rules)。

前置条件

  • 具有安全管理员(Security Admin)或参与者(Contributor)角色的 Azure 订阅
  • 在管理组级别启用适用于 Defender for Cloud 的 Azure Policy 计划
  • 已为安全数据收集配置 Log Analytics 工作区
  • 已获授权的 Microsoft Defender for Cloud 计划(服务器保护需要 P1 或 P2)

工作流程

步骤 1:启用 Defender for Cloud 计划

为每种工作负载类型激活 Defender 计划:服务器、容器、App Service、存储、数据库、Key Vault、资源管理器和 DNS。每个计划提供专项威胁检测和漏洞评估。

# 启用服务器 Defender Plan 2
az security pricing create --name VirtualMachines --tier Standard --subplan P2

# 启用容器 Defender
az security pricing create --name Containers --tier Standard

# 启用带恶意软件扫描的存储 Defender
az security pricing create --name StorageAccounts --tier Standard \
  --extensions '[{"name":"OnUploadMalwareScanning","isEnabled":"True",
  "additionalExtensionProperties":{"CapGBPerMonthPerStorageAccount":"5000"}}]'

# 启用数据库 Defender
az security pricing create --name SqlServers --tier Standard
az security pricing create --name CosmosDbs --tier Standard

# 启用 Key Vault Defender
az security pricing create --name KeyVaults --tier Standard

# 验证所有已启用的计划
az security pricing list --query "[?pricingTier=='Standard'].{Plan:name, Tier:pricingTier, SubPlan:subPlan}" -o table

步骤 2:配置多云环境连接器

将 AWS 账户和 GCP 项目连接到 Defender for Cloud,实现跨云提供商的统一安全态势管理。

# 创建用于 CSPM 的 AWS 连接器
az security security-connector create \
  --name aws-production-connector \
  --resource-group security-rg \
  --environment-name AWS \
  --hierarchy-identifier "123456789012" \
  --offerings '[{
    "offeringType": "CspmMonitorAws",
    "nativeCloudConnection": {"cloudRoleArn": "arn:aws:iam::123456789012:role/DefenderForCloudRole"}
  }]'

# 创建 GCP 连接器
az security security-connector create \
  --name gcp-production-connector \
  --resource-group security-rg \
  --environment-name GCP \
  --hierarchy-identifier "my-gcp-project-id" \
  --offerings '[{"offeringType": "CspmMonitorGcp"}]'

步骤 3:审查并确定安全分数建议优先级

分析所有订阅的安全分数。每项建议都包含基于资产暴露、互联网暴露和威胁情报上下文的风险优先级。

# 获取当前安全分数
az security secure-score list \
  --query "[].{Name:displayName, Score:current, Max:max, Percentage:percentage}" -o table

# 列出按严重级别排序的不健康建议
az security assessment list \
  --query "[?properties.status.code=='Unhealthy'].{Name:properties.displayName, Severity:properties.metadata.severity, Resources:properties.resourceDetails.id}" \
  --output table

# 获取特定建议详情
az security assessment show \
  --assessment-name "4fb67663-9ab9-475d-b026-8c544cced439" \
  --query "{Name:properties.displayName, Description:properties.metadata.description, Remediation:properties.metadata.remediationDescription}"

步骤 4:配置自适应应用控制和 JIT 访问

启用即时(Just-In-Time)虚拟机访问,仅在需要时开放管理端口以减少攻击面;部署自适应应用控制(Adaptive Application Controls)以将批准的可执行文件加入白名单。

# 启用 JIT 虚拟机访问策略
az security jit-policy create \
  --resource-group production-rg \
  --location eastus \
  --name default \
  --virtual-machines '[{
    "id": "/subscriptions/sub-id/resourceGroups/production-rg/providers/Microsoft.Compute/virtualMachines/web-server-01",
    "ports": [
      {"number": 22, "protocol": "TCP", "allowedSourceAddressPrefix": "10.0.0.0/8", "maxRequestAccessDuration": "PT3H"},
      {"number": 3389, "protocol": "TCP", "allowedSourceAddressPrefix": "10.0.0.0/8", "maxRequestAccessDuration": "PT1H"}
    ]
  }]'

# 申请 JIT 访问
az security jit-policy initiate \
  --resource-group production-rg \
  --location eastus \
  --name default \
  --virtual-machines '[{
    "id": "/subscriptions/sub-id/resourceGroups/production-rg/providers/Microsoft.Compute/virtualMachines/web-server-01",
    "ports": [{"number": 22, "duration": "PT1H", "allowedSourceAddressPrefix": "203.0.113.10"}]
  }]'

步骤 5:设置安全告警和工作流自动化

配置工作流自动化,在生成安全告警时触发 Logic Apps 或 Azure Functions。为严重(Critical)和高危(High)级别告警设置电子邮件通知。

# 创建高严重级别告警的工作流自动化
az security automation create \
  --name high-severity-alert-automation \
  --resource-group security-rg \
  --scopes '[{"description": "生产订阅", "scopePath": "/subscriptions/<sub-id>"}]' \
  --sources '[{
    "eventSource": "Alerts",
    "ruleSets": [{"rules": [{"propertyJPath": "Severity", "propertyType": "String", "expectedValue": "High", "operator": "Equals"}]}]
  }]' \
  --actions '[{
    "logicAppResourceId": "/subscriptions/<sub-id>/resourceGroups/security-rg/providers/Microsoft.Logic/workflows/alert-handler",
    "actionType": "LogicApp"
  }]'

# 配置电子邮件通知
az security contact create \
  --name default \
  --email "soc-team@company.com" \
  --alert-notifications "on" \
  --alerts-to-admins "on"

步骤 6:启用云安全图和攻击路径分析

使用云安全图(Cloud Security Graph)可视化攻击者可能利用的、通往关键资产的攻击路径。基于实际可利用性而非单个发现的严重级别来确定修复优先级。

# 通过 Resource Graph 查询攻击路径
az graph query -q "
  securityresources
  | where type == 'microsoft.security/attackpaths'
  | extend riskLevel = properties.riskLevel
  | extend entryPoint = properties.attackPathDisplayName
  | where riskLevel == 'Critical'
  | project entryPoint, riskLevel, properties.description
  | limit 20
"

核心概念

术语定义
安全分数(Secure Score)基于已实施安全建议百分比的组织安全态势数值度量,按订阅评分并在管理组级别汇总
云安全图(Cloud Security Graph)映射云资源、身份、网络暴露和漏洞之间关系的图数据库,用于识别可利用的攻击路径
攻击路径分析(Attack Path Analysis)攻击者从入口点到高价值目标可遵循的多步骤攻击链可视化,按真实可利用性排定优先级
即时访问(Just-In-Time Access)默认阻止管理端口,仅在经批准的请求下临时开放的安全控制措施,减少虚拟机攻击面
自适应应用控制(Adaptive Application Controls)基于机器学习的允许列表,推荐哪些应用程序应在虚拟机上运行,并对偏差发出告警
Defender CSPM增强型云安全态势管理计划,提供无代理扫描、攻击路径分析和云安全图功能
安全连接器(Security Connector)将 AWS 或 GCP 环境连接到 Defender for Cloud 进行多云态势管理的集成节点

工具与系统

  • Microsoft Defender for Cloud:核心 CNAPP 平台,跨 Azure、AWS 和 GCP 提供 CSPM、云工作负载保护(CWP)和威胁防护
  • Azure Resource Graph:用于大规模探索云安全图数据和攻击路径的查询引擎
  • Azure Logic Apps:工作流自动化平台,用于构建由 Defender 告警触发的修复 Playbook
  • Microsoft Defender 门户:将 Defender for Cloud 与 XDR、Sentinel 和威胁情报集成的统一安全运营控制台
  • Azure Policy:将 Defender for Cloud 建议作为合规要求强制执行的治理引擎

常见场景

场景:具有已知漏洞的互联网暴露 SQL Server

场景背景:Defender for Cloud 识别出一个 Azure SQL Server 具有公开端点、未修补的严重 CVE,以及一个同时具有数据库所有者权限的服务主体(Service Principal),该服务主体还能访问包含生产加密密钥的 Key Vault。

方法:

  1. 审查云安全图中的攻击路径:互联网 -> SQL Server(CVE)-> 服务主体 -> Key Vault
  2. 立即将 SQL Server 防火墙限制为仅使用私有端点
  3. 通过 Azure Update Management 应用 SQL Server 安全补丁
  4. 轮换服务主体凭据,并将其权限范围限定为仅所需的数据库操作
  5. 添加 Key Vault 访问策略,要求服务主体通过托管身份(Managed Identity)而非基于密钥的凭据进行认证
  6. 在 24 小时内验证 Defender CSPM 中攻击路径已解决

常见陷阱:仅关注 SQL 漏洞本身会遗漏通往 Key Vault 的横向移动路径。在未更新应用程序连接字符串的情况下限制端点会导致服务中断。

输出格式

Microsoft Defender for Cloud 安全报告
=============================================
租户: acme-corp.onmicrosoft.com
监控订阅数: 12
报告日期: 2025-02-23

安全分数: 72/100

DEFENDER 计划状态:
  服务器(P2):   已启用 - 156 台虚拟机受保护
  容器:           已启用 - 8 个 AKS 集群受保护
  存储:           已启用 - 342 个存储账户,恶意软件扫描激活
  数据库:         已启用 - 23 个 SQL Server,5 个 Cosmos DB 账户
  Key Vault:      已启用 - 18 个密钥库受监控
  AWS 连接器:     已启用 - 3 个账户已连接
  GCP 连接器:     已启用 - 2 个项目已连接

严重攻击路径:
  [AP-001] 互联网 -> 虚拟机(RDP 开放)-> 托管身份 -> 存储(PII 数据)
    风险: 严重 | 受影响资源: 3 | 修复建议: 关闭 RDP,限制托管身份范围
  [AP-002] 互联网 -> App Service(SQL 注入漏洞)-> SQL DB -> 服务主体 -> Key Vault
    风险: 严重 | 受影响资源: 5 | 修复建议: 修补应用,使用私有端点

告警摘要(最近 30 天):
  严重: 5 | 高危: 23 | 中危: 67 | 低危: 134
  主要告警类型:
    - 可疑登录活动(18)
    - 存储中检测到恶意软件(7)
    - 异常资源部署(12)
Skills enregistrées