การวิเคราะห์บันทึกและการกําหนดค่าด้วย GitHub Copilot
Tip
ดูแท็บ ข้อความและรูปภาพ สําหรับรายละเอียดเพิ่มเติม!
สภาพแวดล้อมระบบคลาวด์สมัยใหม่สร้างข้อมูลบันทึกจํานวนมาก Azure Firewall ในสภาพแวดล้อมที่วุ่นวายจะสร้างรายการบันทึกหลายพันรายการต่อชั่วโมง บันทึกกิจกรรมจะบันทึกการดําเนินการจัดการทั้งหมดในทรัพยากรทั้งหมด บันทึกโฟลว์ NSG จะบันทึกทุกการเชื่อมต่อเครือข่าย ทั้งที่อนุญาตและถูกปฏิเสธ
ความท้าทายไม่ใช่การรวบรวมข้อมูล Azure Monitor, Log Analytics และ Microsoft Sentinel จัดการคอลเลกชันได้ดี ความท้าทายคือการเปลี่ยนข้อมูลบันทึกดิบให้เป็นข่าวกรองที่นําไปใช้ได้จริงอย่างรวดเร็ว ซึ่งหมายถึงการค้นหารูปแบบการโจมตีในรายการไฟร์วอลล์ 10,000 รายการระบุสาเหตุที่แท้จริงของความล้มเหลวในการปรับใช้ที่ฝังอยู่ในบันทึกข้อผิดพลาด 500 บรรทัดหรือจัดทํารายงานการปฏิบัติตามข้อกําหนดที่มีความหมายจากข้อมูลกิจกรรมหนึ่งเดือน
GitHub Copilot จัดการการจดจํารูปแบบและการสรุปทํางานได้ดี คุณให้ข้อมูล Copilot ให้การวิเคราะห์
การวิเคราะห์บันทึก Azure Firewall
บันทึกกฎเครือข่าย Azure Firewall จะบันทึกทุกการเชื่อมต่อที่ไฟร์วอลล์ประเมิน: IP ต้นทาง IP ปลายทาง พอร์ต โปรโตคอล และการเชื่อมต่อได้รับอนุญาตหรือปฏิเสธ การวิเคราะห์บันทึกเหล่านี้ด้วยตนเองใช้เวลานาน Copilot สามารถสแกนได้ในไม่กี่วินาที
พรอมต์การวิเคราะห์พื้นฐาน
Analyze these Azure Firewall network rule logs and provide:
1. The top 5 source IPs generating denied traffic, with connection counts
2. The top 5 destination ports targeted by denied traffic
3. Any source IPs with rapid sequential connections to many different ports
(port scanning behavior), including the time window
4. The one-hour period with the highest volume of denied connections
5. Any connections that were ALLOWED to unusual external destinations
(non-standard ports, suspicious IP ranges)
Format the output as a structured report with a section for each finding.
[paste firewall-logs.json content here]
การวิเคราะห์บันทึกไฟร์วอลล์ที่ดีเผยให้เห็นอะไร
การสแกนพอร์ต สามารถระบุได้ด้วย IP ต้นทางเดียวที่เชื่อมต่อกับพอร์ตปลายทางต่างๆ มากมายในกรอบเวลาอันสั้น ไคลเอ็นต์ที่ถูกต้องทําการเชื่อมต่อกับพอร์ตหนึ่งหรือสองพอร์ตซ้ําๆ สแกนเนอร์จะตรวจสอบพอร์ตหลายสิบพอร์ตตามลําดับ
ความพยายามของกําลังดุร้าย จะปรากฏขึ้นเป็นการเชื่อมต่อที่ถูกปฏิเสธจาก IP ต้นทางหนึ่งไปยังพอร์ตปลายทางเดียวกัน ซึ่งโดยทั่วไปคือ 22 (SSH) หรือ 3389 (RDP) ติดต่อกันอย่างรวดเร็ว
ความผิดปกติของการจราจรที่อนุญาต มักจะน่ากังวลมากกว่าการจราจรที่ถูกปฏิเสธ การเชื่อมต่อที่ถูกปฏิเสธจะถูกบล็อก การเชื่อมต่อที่อนุญาตไปยังปลายทางที่ผิดปกติ เช่น พอร์ตที่ไม่ได้มาตรฐานหรือช่วง IP ที่เกี่ยวข้องกับภัยคุกคามที่รู้จัก แสดงถึงการเคลื่อนย้ายข้อมูลจริงที่ควรตรวจสอบ
เปลี่ยนสิ่งที่ค้นพบให้เป็นการเปลี่ยนแปลงโครงสร้างพื้นฐาน
การวิเคราะห์บันทึกควรป้อนกลับไปยังเทมเพลต Bicep ของคุณโดยตรง หลังจากระบุ IP ต้นทางของปัญหาแล้ว ให้ขอให้ Copilot สร้างการแก้ไข:
Based on the firewall log analysis, the following source IPs are confirmed
malicious: 185.220.101.45, 91.230.54.112, 194.165.16.78.
Generate:
1. A Bicep snippet for an Azure Firewall Network Rule Collection that explicitly
denies all traffic from these IPs at the highest priority (100)
2. An Azure CLI command to apply this rule without a full template redeployment
3. A comment explaining the source of each blocked IP
วิธีปิดลูป: วิเคราะห์บันทึก ระบุภัยคุกคาม สร้าง IaC เพื่อบล็อกพวกเขา จากนั้นปรับใช้การแก้ไข วงจรทั้งหมดสามารถเกิดขึ้นได้ภายในเซสชัน Copilot Chat เดียว
การแก้ไขปัญหาความล้มเหลวในการปรับใช้
บันทึกความล้มเหลวในการปรับใช้อาจคลุมเครือ Azure Resource Manager ส่งคืนออบเจ็กต์ข้อผิดพลาด JSON ที่ซ้อนกันพร้อมรหัส ข้อความ และรายละเอียดการประเมินนโยบายที่ต้องใช้เวลาในการแยกวิเคราะห์ Copilot ช่วยลดเสียงรบกวนจากแหล่งต่างๆ ให้หาสาเหตุที่ชัดเจนและแก้ไขได้ในไม่กี่วินาที
พรอมต์การวิเคราะห์ความล้มเหลว
This is an Azure resource deployment log that ended in failure.
Analyze the log and provide:
- The root cause of the failure in plain language, not error codes
- Which specific resource failed and why
- The exact change needed in the Bicep template or deployment parameters to fix the issue
- Whether there are multiple issues (sometimes one error masks another)
If there is a policy violation, explain: which policy blocked the deployment,
what the policy requires, and where in the template the requirement is not met.
[paste failed-deployment.log content here]
ประเภทความล้มเหลวในการปรับใช้ทั่วไป
ข้อผิดพลาดในการปรับขนาดซับเน็ต: Azure Firewall ต้องมีซับเน็ตขั้นต่ํา /26 Azure Bastion ต้องใช้ /26 เครือข่ายเสมือน Gateway ต้องใช้ /27 ขอบเขตเหล่านี้พลาดได้ง่ายและสร้างข้อความแสดงข้อผิดพลาดที่ชัดเจนซึ่ง Copilot สามารถแยกวิเคราะห์และแก้ไขได้
การละเมิดนโยบาย: การกํากับดูแลการสมัครใช้งาน Enterprise Azure ขึ้นอยู่กับ Azure Policy นโยบายทั่วไปกําหนดให้มีแท็กเฉพาะในทรัพยากรทั้งหมด จํากัด SKU เป็นประเภทที่ได้รับอนุมัติ หรือบังคับใช้ขนาดซับเน็ตขั้นต่ํา การละเมิดนโยบายในบันทึกข้อผิดพลาดรวมถึงชื่อนโยบายและนิพจน์เฉพาะที่ประเมินว่าไม่เป็นไปตามข้อกําหนด
ความขัดแย้งของทรัพยากร: การปรับใช้ทรัพยากรที่มีอยู่แล้วด้วยคุณสมบัติที่เข้ากันไม่ได้ ตัวอย่างเช่น บัญชีพื้นที่เก็บข้อมูลที่มี SKU แตกต่างจากบัญชีที่มีอยู่ หรือชื่อ Key Vault ที่ใช้ทั่วโลกแล้ว
ความล้มเหลวในการอนุญาต RBAC: ข้อมูลประจําตัวการปรับใช้ไม่มีสิทธิ์ในการสร้างชนิดทรัพยากรเฉพาะ ตัวอย่างนี้เป็นเรื่องปกติเมื่อปรับใช้การกําหนดบทบาท โดยที่ Microsoft.Authorization/roleAssignments/write ต้องใช้เจ้าของหรือผู้ดูแลระบบการเข้าถึงของผู้ใช้
เวอร์ชัน API ไม่ตรงกัน: ทรัพยากรใช้เวอร์ชัน API ที่ไม่พร้อมใช้งานอีกต่อไป สถานการณ์นี้พบได้บ่อยในเทมเพลตที่ล้าสมัย
ขอแก้ไขใน Bicep
หลังจากที่ Copilot ระบุสาเหตุที่แท้จริงแล้ว ให้ขอให้สร้างการแก้ไข:
The deployment failed because:
1. AzureFirewallSubnet is /27 but must be /26
2. The CostCenter tag is missing from the hub VNet resource
Apply both fixes to this Bicep template. Show only the changed sections,
not the entire template, and explain what you changed and why.
[paste the relevant Bicep sections]
การสร้างคิวรี KQL สําหรับ Azure Monitor
KQL (Kusto Query Language) เป็นภาษาคิวรีสําหรับ Azure Monitor, Log Analytics และ Microsoft Sentinel การเขียน KQL ตั้งแต่เริ่มต้นจําเป็นต้องมีความรู้เกี่ยวกับสคีมาตาราง ฟังก์ชัน KQL และโครงสร้างของบันทึกการวินิจฉัย Azure Copilot สร้างการสืบค้น KQL จากคําอธิบายภาษาธรรมชาติ ซึ่งช่วยลดอุปสรรคลงอย่างมาก
การสร้าง KQL พื้นฐาน
Generate a KQL query for the AzureDiagnostics table in Log Analytics.
The query should:
- Count denied connections grouped by SourceIP
- Filter to the last 24 hours using TimeGenerated > ago(24h)
- Include only rows where Action_s == "Deny"
- Include only rows from Azure Firewall (Category == "AzureFirewallNetworkRule")
- Sort by count descending
- Visualize as a bar chart
Add a comment at the top explaining what this query does and when to use it.
Examp เอาต์พุต KQL:
// Top blocked source IPs in the last 24 hours
// Use this query to identify source IPs generating the most denied traffic.
// Useful for firewall rule tuning and threat hunting.
AzureDiagnostics
| where TimeGenerated > ago(24h)
| where Category == "AzureFirewallNetworkRule"
| where Action_s == "Deny"
| summarize DeniedCount = count() by SourceIP = SourceIp_s
| sort by DeniedCount desc
| render barchart
การสร้างชุดคิวรีความปลอดภัย
Generate three KQL queries for Azure Firewall security monitoring:
Query 1: Allowed SSH/RDP connections
Find all connections to port 22 or 3389 that were allowed by the firewall.
These are potential security risks that should be reviewed.
Query 2: Hourly allowed vs. denied traffic trend
Show the count of allowed and denied connections per hour over the last 7 days,
as a time chart with two series (one for allowed, one for denied).
Query 3: New source IPs in the last 24 hours
Find source IPs that appear in today's denied traffic but did not appear
in the 7 days prior. These are new sources of malicious traffic.
For each query: add explanatory comments, use the AzureDiagnostics table,
and make them production-ready (handle null fields with isnotempty()).
การสร้าง KQL สําหรับบันทึกกิจกรรม
บันทึกกิจกรรมใช้ตาราง AzureActivity ใน Log Analytics สคีมาแตกต่างจากบันทึกการวินิจฉัย และ Copilot ทราบชื่อคอลัมน์
Generate a KQL query for the AzureActivity table that finds:
- All role assignment changes (RBAC) in the last 30 days
- Only operations where OperationNameValue contains "roleAssignments"
- Include: TimeGenerated, Caller, OperationNameValue, ActivityStatusValue,
ResourceGroup, Properties
Sort by TimeGenerated descending. Add a comment explaining how to use
this query for access control auditing.
การสร้างสรุปการตรวจสอบการปฏิบัติตามข้อกําหนด
ทีมการปฏิบัติตามกฎระเบียบและผู้ตรวจสอบจําเป็นต้องมีรายงานที่มีโครงสร้าง ไม่ใช่ข้อมูลบันทึกดิบ Copilot สามารถอ่านไฟล์บันทึกและสร้างสรุปการตรวจสอบระดับมืออาชีพ
พร้อมท์สรุปการปฏิบัติตามข้อกําหนด
Analyze these Azure Activity Log entries and generate a compliance audit summary
in markdown format for the period [date range].
Structure the report as follows:
## Executive Summary
[2-3 sentences summarizing the overall compliance posture]
## Access Control Changes
[Table: Date | Actor | Action | Resource | Risk Rating]
## Resource Deletions
[Table: Date | Actor | Resource | Resource Group | Risk Rating]
## Policy Exemptions
[Table: Date | Actor | Policy | Exemption Scope | Expiry | Risk Rating]
## After-Hours Activity
[Table: Date | Time | Actor | Action | Risk Rating]
[Note: Business hours are 09:00-18:00 in your local time zone]
## Risk Summary
[Count by risk level: High / Medium / Low]
## Recommended Actions
[Bulleted list of follow-up actions based on findings]
Apply risk ratings:
- High: role assignments, policy exemptions, resource deletions in production
- Medium: configuration changes to security resources (Key Vault, NSG, Firewall)
- Low: read operations, tag updates, scaling events
[paste activity-log.json content here]
ผลลัพธ์จะสามารถใช้เป็นรายงานการปฏิบัติตามข้อกําหนด สรุปการตรวจสอบความปลอดภัย หรือส่วนในแพ็คเกจการตอบกลับการตรวจสอบได้ทันที ตรวจสอบการจัดอันดับความเสี่ยงที่ Copilot นําไปใช้ และปรับระดับความเสี่ยงที่ไม่ตรงกับนโยบายการจําแนกความเสี่ยงขององค์กรของคุณ