Task 04: Enable Security Logging
DOCUMENT CATEGORY: Runbook
SCOPE: Security event collection
PURPOSE: Configure Data Collection Rules for security logs
MASTER REFERENCE: Microsoft Learn - DCR
Status: Active
Security logging provides visibility into security events across your Azure Local infrastructure. This step configures Data Collection Rules (DCR) to collect security events from Arc-enabled servers and send them to Log Analytics.
Azure Monitor Agent (AMA) is the recommended agent for log collection, replacing the legacy Log Analytics agent (MMA). DCRs define what data to collect and where to send it.
Overview
| Log Type | Source | Purpose |
|---|---|---|
| Windows Security Events | Windows Event Log | Authentication, authorization, policy changes |
| Syslog | Linux systems | System and security events |
| Performance Counters | OS metrics | Resource utilization and anomaly detection |
| Custom Logs | Application logs | Application-specific security events |
Prerequisites
- Log Analytics workspace created in Stage 06
- Azure Monitor Agent deployed (or will deploy via DCR)
- Arc-enabled servers registered (or will be during cluster deployment)
Values from infrastructure.yml
The values for this task come from infrastructure.yml (schema 5). Every key, with its type, default and example, is in the variables reference.
Security Event Tiers
| Tier | Events Collected | Use Case |
|---|---|---|
| Minimal | Critical security events only | Cost-sensitive environments |
| Common | Important events (recommended) | Standard security monitoring |
| All | Complete security log | Compliance, forensics |
Procedure
- Azure Portal
- Orchestrated Script
Create Data Collection Rule for Security Events
- Navigate to Data Collection Rules
- In Azure Portal, search for Data collection rules
- Click + Create
- Configure Basics
- Rule Name:
dcr-security-events-prod-eus2 - Subscription: Select your subscription
- Resource Group:
rg-management-prod-eastus2 - Region: Same as Log Analytics workspace
- Platform Type: Windows (or All for both Windows and Linux)
- Add Resources (Optional)
- Click + Add resources
- Select Arc-enabled servers (if already registered)
- Or leave empty to assign later during cluster deployment
- Configure Data Sources
Windows Security Events:
- Click + Add data source
- Data source type: Windows Event Logs
- Configure: Select Security under Windows event logs
- Click Add data source
Windows Event Logs:
- Click + Add data source
- Data source type: Windows Event Logs
- Check: System, Application
- Configure XPath queries for specific events (optional)
- Configure Destination
- Click + Add destination
- Destination type: Azure Monitor Logs
- Subscription: Select your subscription
- Destination: Select your Log Analytics workspace
- Review and Create
- Click Review + create
- Click Create
Create Syslog Collection Rule (Linux)
- Create New DCR for Linux
- Rule Name:
dcr-syslog-security-prod-eus2 - Platform Type: Linux
- Add Syslog Data Source
- Click + Add data source
- Data source type: Linux Syslog
- Configure facilities:
auth- LOG_WARNING and aboveauthpriv- LOG_WARNING and abovesyslog- LOG_WARNING and abovedaemon- LOG_ERR and above
- Add Destination
- Select your Log Analytics workspace
- Click Create
PowerShell
No script in this task folder.
Invoke-SecurityLogging-Orchestrated.ps1is a placeholder: it printsNOT IMPLEMENTED, changes nothing and exits with code 3. The task has no Azure CLI script: the audit policy and the Security log size are part of the security baseline on the nodes. The earlierSet-SecurityLogging.ps1is removed: Microsoft Learn documents no supported way to change the audit policies of Azure Local with a script. The security baseline is changed withSet-AzsSecurity(see Task 03: Configure security baselines).
Key Security Events to Collect
| Event ID | Description | Category |
|---|---|---|
| 4624 | Successful logon | Authentication |
| 4625 | Failed logon | Authentication |
| 4648 | Logon with explicit credentials | Authentication |
| 4672 | Special privileges assigned | Privilege Use |
| 4720 | User account created | Account Management |
| 4726 | User account deleted | Account Management |
| 4728 | Member added to security group | Group Management |
| 4738 | User account changed | Account Management |
| 4768 | Kerberos TGT requested | Kerberos |
| 4769 | Kerberos service ticket requested | Kerberos |
Validation
# Verify DCR exists
$dcr = Get-AzDataCollectionRule -ResourceGroupName $resourceGroup -Name $dcrName
if ($dcr) {
Write-Host "✅ DCR exists: $($dcr.Name)" -ForegroundColor Green
Write-Host " Location: $($dcr.Location)"
Write-Host " Data Sources: $($dcr.DataSource.WindowsEventLog.Count) Windows Event Logs"
} else {
Write-Host "❌ DCR not found" -ForegroundColor Red
}
# Query Log Analytics for security events (after data starts flowing)
$query = @"
SecurityEvent
| where TimeGenerated > ago(1h)
| summarize count() by EventID
| order by count_ desc
| take 10
"@
Write-Host "`nQuerying for security events..." -ForegroundColor Cyan
# Note: Events may take 5-10 minutes to appear after DCR association
Expected Output
After Arc-enabled servers are registered and associated with the DCR:
SecurityEvent
| summarize count() by EventID
EventID count_
------- ------
4624 1547
4625 23
4672 892
4648 156
4768 2341
4769 8923
Assigning DCR to Arc-Enabled Servers
Once Arc-enabled servers are registered during cluster deployment, associate them with the DCR:
# Get DCR resource ID
$dcrId = (Get-AzDataCollectionRule -ResourceGroupName $resourceGroup -Name $dcrName).Id
# Associate with Arc-enabled server
$arcServerResourceId = "/subscriptions/$subscriptionId/resourceGroups/rg-azurelocal-prod-eastus2/providers/Microsoft.HybridCompute/machines/azl-node-01"
New-AzDataCollectionRuleAssociation `
-TargetResourceId $arcServerResourceId `
-AssociationName "dcr-association-node01" `
-RuleId $dcrId
Troubleshooting
| Issue | Cause | Resolution |
|---|---|---|
DCR creation fails with WorkspaceId invalid | Log Analytics workspace not found or wrong region | Verify workspace exists with Get-AzOperationalInsightsWorkspace; ensure DCR and workspace are in the same region |
| Security events not appearing in Log Analytics | AMA not installed or DCR association missing | Verify AMA extension: az connectedmachine extension list; check DCR association: Get-AzDataCollectionRuleAssociation |
| Partial event collection (some event types missing) | DCR XPath queries don't cover required event channels | Update DCR data sources to include all required Windows event channels (Security, System, Application) |
Next Steps
This is the last task of the phase. Proceed to Phase 05: Licensing & Telemetry.
Scripts for this task are located in the azurelocal-toolkit repository under scripts/deploy/ in the appropriate task folder.
Alternatives
The procedures in this task use the methods shown in the tabs above. The toolkit is PowerShell 7 only and has no Bash scripts. A few tasks that act on Azure also have an Azure CLI script written in PowerShell. The script status page of the toolkit lists which task has which script.
Navigation
| Previous | Up | Next |
|---|---|---|
| ← Task 03: Security Baselines | Phase 04: Security & Governance | Phase 05: Licensing & Telemetry → |
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0.0 | 2026-03-24 | Azure Local Cloud | Initial release |
Version Control
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0.0 | 2025-03-25 | Azure Local Cloud | Initial release |