Communitygithub.com

Azure Active Directory 構成監査

Microsoft Entra ID (Azure Active Directory) の構成を監査し、セキュリティ評価やコンプライアンス監査を支援します。

Azure Active Directory 構成監査 とは?

このスキルは、Azure テナントの ID 構成に関する包括的なセキュリティ評価を実施するためのものです。セキュリティデフォルトの状態、条件付きアクセスポリシーの有効性、特権ロールの割り当て、古いアカウントやゲストユーザーの状態、サインインログのリスク分析を自動化します。主に Microsoft Graph PowerShell SDK、Az CLI、ScoutSuite といったツールを活用し、テナントの脆弱性や構成ミスを特定します。MFA の強制状況やレガシー認証のブロック状態を確認し、条件付きアクセスポリシーのカバレッジ不足を明らかにします。監査結果は構造化されたレポートとして出力され、特権アクセス管理 (PIM) の導入推奨や、危険なサインインの検出など、実用的な改善点を提示します。Azure AD Premium P1/P2 ライセンスが必要な監査ログや Identity Protection 機能にも対応しており、合併・買収後のテナント統合やコンプライアンス監査に特に有効です。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/auditing-azure-active-directory-configuration

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Azure Active Directory 構成監査 は何をしますか?

使用タイミング

  • Azure テナントの ID 構成に関するセキュリティ評価を実施する場合
  • 認証ポリシー、MFA 強制、ロール割り当てのレビューが必要なコンプライアンス監査時
  • 合併・買収後に新しい Azure テナントをオンボーディングする場合
  • 不審なサインインアクティビティやアカウント侵害を調査する場合
  • 条件付きアクセスポリシーが ID ベースの攻撃に対して適切に保護しているか検証する場合

使用しない状況: オンプレミスの Active Directory 監査(PingCastle または BloodHound AD を使用)、ID コンテキストなしの Azure リソースレベル RBAC 監査、リアルタイムの脅威検出(Microsoft Defender for Identity を使用)。

前提条件

  • 対象の Microsoft Entra ID テナントにおける全体閲覧者またはセキュリティ閲覧者ロール
  • Microsoft Graph PowerShell SDK がインストールされている(Install-Module Microsoft.Graph)
  • Az CLI が対象テナントに認証されている(az login --tenant TENANT_ID)
  • ScoutSuite が自動評価のために Azure プロバイダーとともに設定されている
  • Azure AD 監査ログとサインインログへのアクセス(Azure AD Premium P1/P2 が必要)

ワークフロー

ステップ 1: テナント構成とセキュリティデフォルトの列挙

テナントのベースライン ID セキュリティ設定(セキュリティデフォルトやレガシー認証の状態を含む)を評価します。

# Microsoft Graph に接続
Connect-MgGraph -Scopes "Directory.Read.All","Policy.Read.All","AuditLog.Read.All"

# テナントの詳細を取得
Get-MgOrganization | Select-Object DisplayName, Id, VerifiedDomains

# セキュリティデフォルトが有効か確認
Get-MgPolicyIdentitySecurityDefaultEnforcementPolicy | Select-Object IsEnabled

# 認証方法ポリシーの一覧
Get-MgPolicyAuthenticationMethodPolicy | ConvertTo-Json -Depth 5

# 条件付きアクセスを使用してレガシー認証の状態を確認
Get-MgIdentityConditionalAccessPolicy | Where-Object {
    $_.Conditions.ClientAppTypes -contains "exchangeActiveSync" -or
    $_.Conditions.ClientAppTypes -contains "other"
} | Select-Object DisplayName, State

ステップ 2: 特権ロール割り当ての監査

ディレクトリロールの割り当てをレビューし、過剰権限ユーザー、永続的な管理者アカウント、リスクのあるロール構成を特定します。

# すべての全体管理者の割り当てを一覧表示
az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/directoryRoles/filterByIds" \
  --body '{"ids":["62e90394-69f5-4237-9190-012177145e10"]}' | \
  az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/directoryRoles?filter=displayName eq 'Global Administrator'" \
  --query "value[0].id" -o tsv

# Graph API を使用してすべての特権ロール割り当てを一覧表示
az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments?$expand=principal" \
  --query "value[*].{Role:roleDefinitionId, Principal:principal.displayName, PrincipalType:[email protected]}" \
  -o table

# 複数の管理者ロールを持つユーザーを確認
az ad user list --query "[].{UPN:userPrincipalName, DisplayName:displayName}" -o table

# 管理者ロール割り当てを持つサービスプリンシパルを一覧表示
az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments?$filter=principalOrganizationId eq 'TENANT_ID'" \
  -o json

ステップ 3: 条件付きアクセスポリシーのレビュー

条件付きアクセスポリシーを監査し、特に MFA 強制、デバイスコンプライアンス、場所ベースの制限に関するカバレッジギャップを特定します。

# すべての条件付きアクセスポリシーを一覧表示
Get-MgIdentityConditionalAccessPolicy | Select-Object DisplayName, State, @{
    N='GrantControls'; E={$_.GrantControls.BuiltInControls -join ', '}
} | Format-Table -AutoSize

# レポートのみモード(未強制)のポリシーを特定
Get-MgIdentityConditionalAccessPolicy | Where-Object {$_.State -eq "enabledForReportingButNotEnforced"} |
    Select-Object DisplayName

# MFA 強制のカバレッジを確認
Get-MgIdentityConditionalAccessPolicy | Where-Object {
    $_.GrantControls.BuiltInControls -contains "mfa"
} | Select-Object DisplayName, State, @{
    N='Users'; E={$_.Conditions.Users.IncludeUsers -join ', '}
}

# グループを除外するポリシー(バイパスの可能性)を検索
Get-MgIdentityConditionalAccessPolicy | Where-Object {
    $_.Conditions.Users.ExcludeGroups.Count -gt 0
} | Select-Object DisplayName, @{
    N='ExcludedGroups'; E={$_.Conditions.Users.ExcludeGroups -join ', '}
}

ステップ 4: 古いアカウントとゲストユーザーの特定

最近サインインしていないアカウント、アクティブなロール割り当てを持つ無効なアカウント、リスクのあるゲストユーザー構成を検索します。

# 90 日以上サインインしていないユーザーを検索
az ad user list --query "[?signInActivity.lastSignInDateTime < '2025-11-25T00:00:00Z'].{UPN:userPrincipalName, LastSignIn:signInActivity.lastSignInDateTime, Enabled:accountEnabled}" -o table

# すべてのゲストユーザーを一覧表示
az ad user list --filter "userType eq 'Guest'" \
  --query "[].{UPN:userPrincipalName, DisplayName:displayName, CreatedDate:createdDateTime}" \
  -o table

# 特権ロールを持つゲストユーザーを検索
az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments?$expand=principal" \
  --query "value[?principal.userType=='Guest'].{Role:roleDefinitionId,Guest:principal.userPrincipalName}" \
  -o table

# MFA が無効なアカウントを確認
az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/reports/authenticationMethods/userRegistrationDetails" \
  --query "value[?!isMfaRegistered].{UPN:userPrincipalName,MfaRegistered:isMfaRegistered}" \
  -o table

ステップ 5: サインインログのリスク分析

サインインログをレビューし、異常な認証パターン、失敗した MFA チャレンジ、リスクのあるサインイン検出を特定します。

# 過去 7 日間のリスクのあるサインインを取得
az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=riskLevelDuringSignIn ne 'none' and createdDateTime ge 2026-02-16T00:00:00Z" \
  --query "value[*].{User:userPrincipalName,Risk:riskLevelDuringSignIn,IP:ipAddress,App:appDisplayName,Status:status.errorCode}" \
  -o table

# 未知の場所からのサインインを取得
az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=riskEventTypes_v2/any(r:r eq 'unfamiliarFeatures')" \
  --query "value[*].{User:userPrincipalName,Location:location.city,IP:ipAddress}" \
  -o table

# レガシー認証のサインインを確認
az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=clientAppUsed ne 'Browser' and clientAppUsed ne 'Mobile Apps and Desktop clients'" \
  --query "value[*].{User:userPrincipalName,ClientApp:clientAppUsed,Status:status.errorCode}" \
  -o table

ステップ 6: ScoutSuite 自動評価の実行

ScoutSuite を実行し、Azure テナント構成全体の包括的な自動チェックを実施します。

# ScoutSuite を Azure に対して実行
python3 -m ScoutSuite azure --cli \
  --report-dir ./scoutsuite-azure-report \
  --all-subscriptions

# 生成された HTML レポートを確認
open ./scoutsuite-azure-report/azure-report.html

主要概念

用語定義
Microsoft Entra ID旧称 Azure Active Directory であり、認証と承認を提供する Microsoft のクラウド ID およびアクセス管理サービス
条件付きアクセスシグナル(ユーザー、デバイス、場所、リスク)を評価して MFA、デバイスコンプライアンス、アクセスブロックなどのアクセス制御を強制するポリシーエンジン
セキュリティデフォルトMFA 登録を強制し、レガシー認証をブロックし、特権アクションを保護する Microsoft のベースライン ID 保護設定
Privileged Identity Management (PIM)Azure AD Premium P2 機能で、承認ワークフローと時間制限付きのロールアクティベーションによる Just-In-Time 特権アクセスを可能にする
レガシー認証MFA をサポートしない古い認証プロトコル(POP3、IMAP、SMTP、ActiveSync)であり、資格情報攻撃によく悪用される
リスクのあるサインインMicrosoft Entra Identity Protection によるサインイン異常の検出。移動困難、未知の場所、マルウェアに関連する IP などが含まれる

ツールとシステム

  • Microsoft Graph API: Entra ID の構成、ポリシー、ロール、監査ログを照会するための主要なプログラムインターフェース
  • Microsoft Graph PowerShell SDK: Entra ID 管理とセキュリティ監査タスクのための PowerShell モジュール
  • ScoutSuite: IAM、ストレージ、ネットワーキング、ID チェックのための Azure プロバイダーをサポートするマルチクラウド監査ツール
  • AzureADRecon: 包括的な Azure AD 偵察とセキュリティ評価レポートのためのコミュニティツール
  • Microsoft Defender for Identity: ID ベースの脅威と侵害された資格情報を検出するクラウドベースのセキュリティソリューション

一般的なシナリオ

シナリオ: 買収後の Azure テナントセキュリティ評価

コンテキスト: 企業買収後、セキュリティチームは Azure テナントの ID 状態を評価し、企業の Entra ID に統合する前に確認する必要があります。

アプローチ:

  1. すべての全体管理者を列挙し、管理者ロールに個人アカウントがないか確認
  2. 条件付きアクセスポリシーをレビューし、管理者だけでなく全ユーザーに MFA が強制されているか確認
  3. 特権アクセスを持つゲストユーザーを特定し、サードパーティベンダーの過剰な権限付与の可能性をチェック
  4. 資格情報攻撃の標的となり得る古いアカウント(90 日以上サインインなし)を確認
  5. MFA をバイパスするレガシー認証の使用状況をサインインログで確認
  6. セキュリティデフォルトまたは同等の CA ポリシーがレガシー認証プロトコルをブロックしているか確認
  7. テナント統合前に優先度の高い修復手順を含むリスクレポートを作成

注意点: リスクのあるサインイン検出と PIM には Azure AD Premium P2 が必要です。買収されたテナントが低いライセンス階層を使用している場合、多くの ID 保護機能が利用できなくなります。パートナーテナントからのゲストユーザーは、標準のロール割り当てクエリでは表示されない動的グループを介して暗黙的なアクセス権を持っている場合があります。

出力形式

Azure Active Directory Security Audit Report
===============================================
Tenant: acme-acquired.onmicrosoft.com
Tenant ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890
Audit Date: 2026-02-23
License: Azure AD Premium P2

IDENTITY CONFIGURATION:
  Security Defaults: Disabled (Conditional Access in use)
  Conditional Access Policies: 12 (8 enforced, 3 report-only, 1 disabled)
  Legacy Auth Blocked: Partial (blocked for admins only)

PRIVILEGED ACCESS:
  Global Administrators:              8 (recommended: <= 4)
  Permanent admin assignments:        6 (no PIM activation required)
  Service principals with admin:      3
  Guest users with privileged roles:  2

ACCOUNT HYGIENE:
  Total users:                        1,247
  Stale accounts (90+ days):          89
  Guest users:                        234
  Users without MFA registered:       156

SIGN-IN RISK:
  Risky sign-ins (last 30 days):      34
  Legacy auth sign-ins (last 7 days): 67
  Impossible travel detections:        5
  Unfamiliar location sign-ins:       12

CRITICAL FINDINGS:
  1. 8 Global Administrators with permanent assignments (use PIM)
  2. Legacy authentication not blocked for non-admin users
  3. 156 users without MFA registration
  4. 2 guest users with Privileged Role Administrator role

Individual skills in this repo

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

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

関連スキル