securing-azure-with-microsoft-defender について
Microsoft Defender for Cloud で Azure のクラウドセキュリティを管理するチーム向けのスキルです。セキュリティ態勢の評価、脅威対策、マルチクラウド接続、攻撃経路分析、アラートの自動化を扱います。
主な機能
- 01ワークロード別 Defender プランの有効化
- 02AWS および GCP 環境の接続
- 03Secure Score の評価項目の確認と優先順位付け
- 04JIT アクセスとアプリ制御の設定
- 05セキュリティアラートのワークフロー自動化
- 06クラウドの攻撃経路分析
活用シーン
- 01Azure サブスクリプションのセキュリティ基準の策定
- 02Azure、AWS、GCP のセキュリティ態勢の確認
- 03AKS クラスターとコンテナーレジストリの保護
- 04重要資産に至る攻撃経路の調査
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill securing-azure-with-microsoft-defenderインストール後、Claude Code で/securing-azure-with-microsoft-defenderを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
LICENSEreferences/api-reference.mdscripts/agent.py詳細
Microsoft Defender による Azure のセキュリティ保護
使用する場面
- Azure サブスクリプションとリソースグループ全体にクラウドワークロード保護をデプロイする場合
- セキュアスコアのベースラインを確立し、セキュリティに関する推奨事項の優先順位を付ける場合
- AWS や GCP を含むマルチクラウド環境に脅威保護を拡張する場合
- AKS クラスターと Azure Container Registry のコンテナーセキュリティを有効にする場合
- Data and AI セキュリティダッシュボードと AI ワークロードのセキュリティを統合する場合
次の場合は使用しないでください:AWS のみの環境(implementing-aws-security-hub を参照)、ID プロバイダーの構成(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 プランを有効にします:Servers、Containers、App Service、Storage、Databases、Key Vault、Resource Manager、DNS。各プランは、専用の脅威検出機能と脆弱性評価機能を提供します。
# Enable Defender for Servers Plan 2
az security pricing create --name VirtualMachines --tier Standard --subplan P2
# Enable Defender for Containers
az security pricing create --name Containers --tier Standard
# Enable Defender for Storage with malware scanning
az security pricing create --name StorageAccounts --tier Standard \
--extensions '[{"name":"OnUploadMalwareScanning","isEnabled":"True",
"additionalExtensionProperties":{"CapGBPerMonthPerStorageAccount":"5000"}}]'
# Enable Defender for Databases
az security pricing create --name SqlServers --tier Standard
az security pricing create --name CosmosDbs --tier Standard
# Enable Defender for Key Vault
az security pricing create --name KeyVaults --tier Standard
# Verify all enabled plans
az security pricing list --query "[?pricingTier=='Standard'].{Plan:name, Tier:pricingTier, SubPlan:subPlan}" -o table
ステップ 2:マルチクラウド用の環境コネクタを構成する
AWS アカウントと GCP プロジェクトを Defender for Cloud に接続し、複数のクラウドプロバイダーにわたるセキュリティ態勢を統合的に管理します。
# Create AWS connector for CSPM
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"}
}]'
# Create GCP connector
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:セキュアスコアの推奨事項を確認し、優先順位を付ける
すべてのサブスクリプションのセキュアスコアを分析します。各推奨事項には、資産の露出状況、インターネットへの露出状況、脅威インテリジェンスのコンテキストに基づくリスクの優先度が含まれます。
# Get current Secure Score
az security secure-score list \
--query "[].{Name:displayName, Score:current, Max:max, Percentage:percentage}" -o table
# List unhealthy recommendations sorted by severity
az security assessment list \
--query "[?properties.status.code=='Unhealthy'].{Name:properties.displayName, Severity:properties.metadata.severity, Resources:properties.resourceDetails.id}" \
--output table
# Get specific recommendation details
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 VM アクセスを有効にします。また、アダプティブアプリケーション制御をデプロイし、承認済みの実行可能ファイルを許可リストに登録します。
# Enable JIT VM access policy
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"}
]
}]'
# Request JIT access
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 のアラートについて、メール通知を設定します。
# Create workflow automation for high severity alerts
az security automation create \
--name high-severity-alert-automation \
--resource-group security-rg \
--scopes '[{"description": "Production subscription", "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"
}]'
# Configure email notifications
az security contact create \
--name default \
--email "[email protected]" \
--alert-notifications "on" \
--alerts-to-admins "on"
ステップ 6:クラウドセキュリティグラフと攻撃経路分析を有効にする
クラウドセキュリティグラフを使用して、攻撃者が重要な資産に到達するために悪用できる攻撃経路を可視化します。個々の検出結果の重大度ではなく、実際の悪用可能性に基づいて修復の優先順位を付けます。
# Query attack paths via 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
"
主な概念
| 用語 | 定義 |
|---|---|
| セキュアスコア | 実装済みのセキュリティ推奨事項の割合に基づく、組織のセキュリティ態勢を数値で示す指標です。サブスクリプションごとにスコアが付けられ、管理グループレベルで集計されます |
| クラウドセキュリティグラフ | クラウドリソース、ID、ネットワークへの露出、脆弱性の関係をマッピングし、悪用可能な攻撃経路を特定するグラフデータベースです |
| 攻撃経路分析 | 攻撃者が侵入地点から価値の高い標的までたどる可能性のある、複数段階の攻撃チェーンを可視化し、実環境での悪用可能性に基づいて優先順位を付ける機能です |
| Just-In-Time アクセス | 管理ポートを既定でブロックし、承認されたリクエストに応じて一時的に開放することで、VM の攻撃対象領域を縮小するセキュリティ制御です |
| アダプティブアプリケーション制御 | 機械学習ベースの許可リスト機能です。VM で実行すべきアプリケーションを推奨し、逸脱を検知するとアラートを発します |
| Defender CSPM | エージェントレススキャン、攻撃経路分析、クラウドセキュリティグラフ機能を提供する、強化されたクラウドセキュリティ態勢管理プランです |
| セキュリティコネクタ | マルチクラウドのセキュリティ態勢管理のために、AWS または GCP 環境を Defender for Cloud に接続する統合ポイントです |
ツールとシステム
- Microsoft Defender for Cloud:Azure、AWS、GCP 全体にわたり、CSPM、CWP、脅威保護を提供する中核的な CNAPP プラットフォーム
- Azure Resource Graph:クラウドセキュリティグラフのデータや攻撃経路を大規模に調査するためのクエリエンジン
- Azure Logic Apps:Defender のアラートをトリガーとして修復プレイブックを構築するためのワークフロー自動化プラットフォーム
- Microsoft Defender Portal:Defender for Cloud を XDR、Sentinel、脅威インテリジェンスと統合する統合セキュリティ運用コンソール
- Azure Policy:Defender for Cloud の推奨事項をコンプライアンス要件として適用するガバナンスエンジン
よくあるシナリオ
シナリオ:既知の脆弱性があるインターネット公開 SQL Server
コンテキスト:Defender for Cloud が、パブリックエンドポイントを持ち、未適用の重大な CVE がある Azure SQL Server と、データベース所有者権限を持ち、本番環境の暗号化キーを含む Key Vault にもアクセスできるサービスプリンシパルを特定します。
アプローチ:
- クラウドセキュリティグラフで攻撃経路を確認します。表示される経路は、インターネット -> SQL Server(CVE)-> サービスプリンシパル -> Key Vault です。
- SQL Server のファイアウォールをプライベートエンドポイントのみに直ちに制限します。
- Azure Update Management を通じて SQL Server のセキュリティパッチを適用します。
- サービスプリンシパルの資格情報をローテーションし、必要なデータベース操作のみに権限を限定します。
- サービスプリンシパルがシークレットベースの資格情報ではなく、マネージド ID を使用して認証することを必須とする Key Vault アクセスポリシーを追加します。
- 24 時間以内に Defender CSPM で攻撃経路が解消されたことを確認します。
落とし穴:SQL の脆弱性だけに注目すると、Key Vault への横方向の移動経路を見落とします。アプリケーションの接続文字列を更新せずにエンドポイントを制限すると、停止が発生します。
出力形式
Microsoft Defender for Cloud Security Report
=============================================
Tenant: acme-corp.onmicrosoft.com
Subscriptions Monitored: 12
Report Date: 2025-02-23
SECURE SCORE: 72/100
DEFENDER PLANS STATUS:
Servers (P2): ENABLED - 156 VMs covered
Containers: ENABLED - 8 AKS clusters covered
Storage: ENABLED - 342 storage accounts, malware scanning active
Databases: ENABLED - 23 SQL servers, 5 Cosmos DB accounts
Key Vault: ENABLED - 18 vaults monitored
AWS Connector: ENABLED - 3 accounts connected
GCP Connector: ENABLED - 2 projects connected
CRITICAL ATTACK PATHS:
[AP-001] Internet -> VM (RDP open) -> Managed Identity -> Storage (PII data)
Risk: Critical | Affected Resources: 3 | Remediation: Close RDP, restrict MI scope
[AP-002] Internet -> App Service (SQLi vuln) -> SQL DB -> Service Principal -> Key Vault
Risk: Critical | Affected Resources: 5 | Remediation: Patch app, private endpoint
ALERT SUMMARY (Last 30 Days):
Critical: 5 | High: 23 | Medium: 67 | Low: 134
Top Alert Types:
- Suspicious login activity (18)
- Malware detected in storage (7)
- Anomalous resource deployment (12)