Task 01: Configure Log Analytics Workspace
DOCUMENT CATEGORY: Runbook
SCOPE: Log Analytics workspace configuration
PURPOSE: Create the foundational workspace for all monitoring data collection
MASTER REFERENCE: Microsoft Learn - Log Analytics Workspace
Status: Active
The Log Analytics workspace is the foundation for all Azure Local monitoring. It stores performance metrics, event logs, security data, and custom logs from cluster nodes, network devices, and Arc-enabled resources. This workspace must be created before enabling HCI Insights, Azure Monitor Agent, or any alerting.
Prerequisites
| Requirement | Description | Validation |
|---|---|---|
| Azure Subscription | Active subscription with billing | Portal access confirmed |
| Resource Group | {{AZURE_RESOURCE_GROUP}} exists | az group show |
| RBAC Permissions | Contributor or Owner on resource group | Role assignment verified |
| Region Selection | Same region as Azure Local cluster | Latency considerations |
Values from infrastructure.yml
The script reads these keys from infrastructure.yml (schema 5). Each key, with its type, default and example, is in the variables reference.
Deploy-DataCollectionEndpoint.ps1:
azure.tenant_id, azure.subscription_id, azure.location (fallback region), tags
operations.monitoring.enabled false means: do nothing
operations.monitoring.log_analytics_workspace the workspace that must exist
operations.monitoring.workspace_resource_group the resource group of the workspace and of the endpoint
operations.monitoring.data_collection_endpoint the endpoint name
Deploy-LogAnalyticsWorkspace.ps1:
azure.tenant_id, azure.subscription_id, azure.location, tags
operations.monitoring.enabled false means: do nothing
operations.monitoring.log_analytics_workspace the workspace name
operations.monitoring.workspace_resource_group the resource group of the workspace; it must exist
operations.monitoring.retention_days optional; the retention of a workspace the script creates (30 to 730)
Overview
flowchart LR
subgraph "Data Sources"
A[Cluster Nodes]
B[Arc Servers]
C[Network Devices]
D[Azure Resources]
end
subgraph "Collection"
E[Azure Monitor Agent]
F[Data Collection Rules]
G[Syslog Forwarder]
end
subgraph "Log Analytics"
H[Workspace]
I[Tables]
J[Queries]
end
A --> E --> F --> H
B --> E
C --> G --> H
D --> H
H --> I --> J
Configuration Options
- Azure Portal
- Orchestrated Script
- Azure CLI
Step 1.1: Create Log Analytics Workspace
- Navigate to Azure Portal → Log Analytics workspaces
- Click + Create
- Configure workspace settings:
| Setting | Value | Notes |
|---|---|---|
| Subscription | {{AZURE_SUBSCRIPTION_NAME}} | Select target subscription |
| Resource Group | {{AZURE_RESOURCE_GROUP}} | Use existing monitoring RG |
| Name | {{LOG_ANALYTICS_WORKSPACE_NAME}} | e.g., law-azl-{{SITE_CODE}}-prod-01 |
| Region | {{AZURE_REGION}} | Same as cluster resources |
- Click Review + Create → Create
Step 1.2: Configure Data Retention
- Open the workspace → Settings → Usage and estimated costs
- Click Data Retention
- Set retention period:
- Default: 30 days (free)
- Recommended: 90 days for operational data
- Compliance: 365+ days for audit requirements
Step 1.3: Configure Access Control
- Navigate to workspace → Access control (IAM)
- Add role assignments:
| Role | Principal | Purpose |
|---|---|---|
| Log Analytics Contributor | Azure Local Cloud Admin Group | Full management |
| Log Analytics Reader | Operations Team | View logs and queries |
| Monitoring Contributor | Automation Account | DCR management |
PowerShell
When to use: Run the task from a management workstation or a pipeline. The script reads
infrastructure.ymland carries no values of its own.
Script
| Script | What it does |
|---|---|
scripts/deploy/05-operational-foundations/phase-02-monitoring-observability/task-01-configure-log-analytics-workspace/powershell/Deploy-DataCollectionEndpoint.ps1 | Creates the Azure Monitor data collection endpoint that operations.monitoring of infrastructure.yml names. Supports -WhatIf. |
scripts/deploy/05-operational-foundations/phase-02-monitoring-observability/task-01-configure-log-analytics-workspace/powershell/Deploy-LogAnalyticsWorkspace.ps1 | Creates the Log Analytics workspace that operations.monitoring of infrastructure.yml names. Supports -WhatIf. |
Requires: PowerShell 7.
Run
./Deploy-DataCollectionEndpoint.ps1 -InfrastructureFile ./infrastructure.yml -WhatIf
./Deploy-LogAnalyticsWorkspace.ps1 -InfrastructureFile ./infrastructure.yml -WhatIf
Azure CLI
When to use: Run the task from a host that has the Azure CLI and not the Az PowerShell modules. The script is PowerShell 7 that calls
az; it readsinfrastructure.ymland carries no values of its own.
Script
| Script | What it does |
|---|---|
scripts/deploy/05-operational-foundations/phase-02-monitoring-observability/task-01-configure-log-analytics-workspace/azurecli/Deploy-LogAnalyticsWorkspace.azcli.ps1 | Creates the Log Analytics workspace that operations.monitoring of infrastructure.yml names, with the Azure CLI. Supports -WhatIf. |
scripts/deploy/05-operational-foundations/phase-02-monitoring-observability/task-01-configure-log-analytics-workspace/azurecli/Deploy-DataCollectionEndpoint.azcli.ps1 | Creates the Azure Monitor data collection endpoint that operations.monitoring of infrastructure.yml names, with the Azure CLI. Supports -WhatIf. |
Requires: PowerShell 7 and the Azure CLI, signed in with az login --tenant <azure.tenant_id>.
Run the workspace script first: the endpoint is created in the region of the workspace. The resource group must exist (a missing group is a failure). The pricing tier is not set, and the retention is operations.monitoring.retention_days (the Azure default of 30 days without it). The endpoint is left open to the public network, the Azure default. With operations.monitoring.enabled false both scripts do nothing and exit 0. An existing resource is left alone; a different region or retention is reported, not changed.
Run
./Deploy-LogAnalyticsWorkspace.azcli.ps1 -InfrastructureFile ./infrastructure.yml -WhatIf
./Deploy-LogAnalyticsWorkspace.azcli.ps1 -InfrastructureFile ./infrastructure.yml
./Deploy-DataCollectionEndpoint.azcli.ps1 -InfrastructureFile ./infrastructure.yml -WhatIf
./Deploy-DataCollectionEndpoint.azcli.ps1 -InfrastructureFile ./infrastructure.yml
Configure Data Sources
After creating the workspace, configure the data sources that will send data:
Windows Event Logs
Navigate to Workspace → Settings → Agents → Windows event logs:
| Log Name | Event Levels |
|---|---|
Microsoft-Windows-Health/Operational | Error, Warning, Information |
Microsoft-Windows-SDDC-Management/Operational | Error, Warning, Information |
System | Error, Warning |
Application | Error, Warning |
Microsoft-Windows-Hyper-V-VMMS-Admin | Error, Warning |
Performance Counters
Configure performance counters for HCI Insights compatibility:
| Counter | Sample Interval |
|---|---|
Memory(*)\Available Bytes | 60 seconds |
Network Interface(*)\Bytes Total/sec | 60 seconds |
Processor(_Total)\% Processor Time | 60 seconds |
RDMA Activity(*)\RDMA Inbound Bytes/sec | 60 seconds |
RDMA Activity(*)\RDMA Outbound Bytes/sec | 60 seconds |
Cluster CSV File System(*)\Read Latency | 60 seconds |
Cluster CSV File System(*)\Write Latency | 60 seconds |
Data Collection Endpoint (DCE)
For Azure Monitor Agent to send data, create a Data Collection Endpoint:
# Create Data Collection Endpoint
$dce = New-AzDataCollectionEndpoint `
-ResourceGroupName $ResourceGroup `
-Name "dce-{{SITE_CODE}}-azl-01" `
-Location $Location `
-NetworkAclsPublicNetworkAccess "Enabled"
Write-Host "DCE Resource ID: $($dce.Id)"
Important: Keep the DCE in the same region as the Log Analytics workspace to avoid data ingestion issues.
Validation
Verify Workspace Creation
# Verify workspace exists and is accessible
$workspace = Get-AzOperationalInsightsWorkspace `
-ResourceGroupName "{{AZURE_RESOURCE_GROUP}}" `
-Name "{{LOG_ANALYTICS_WORKSPACE_NAME}}"
if ($workspace.ProvisioningState -eq "Succeeded") {
Write-Host "✅ Workspace created successfully" -ForegroundColor Green
Write-Host " Resource ID: $($workspace.ResourceId)"
Write-Host " Customer ID: $($workspace.CustomerId)"
Write-Host " Retention: $($workspace.RetentionInDays) days"
} else {
Write-Host "❌ Workspace creation failed: $($workspace.ProvisioningState)" -ForegroundColor Red
}
Test Query Capability
# Run a simple query to verify connectivity
$query = "Heartbeat | take 5"
$result = Invoke-AzOperationalInsightsQuery `
-WorkspaceId $workspace.CustomerId `
-Query $query
Write-Host "Query executed successfully. Results: $($result.Results.Count)"
Troubleshooting
| Issue | Possible Cause | Resolution |
|---|---|---|
| Workspace creation fails | Insufficient permissions | Verify Contributor role on resource group |
| No data appearing | DCR not configured | Complete Step 2 (Azure Monitor Agent) |
| Query timeout | Large data volume | Narrow time range or add filters |
| Region mismatch errors | DCE in different region | Create DCE in same region as workspace |
Variables Reference
| Variable | Description | Example |
|---|---|---|
{{AZURE_SUBSCRIPTION_ID}} | Target subscription ID | 12345678-1234-... |
{{AZURE_RESOURCE_GROUP}} | Monitoring resource group | rg-azl-prod-monitoring |
{{LOG_ANALYTICS_WORKSPACE_NAME}} | Workspace name | law-azl-dal-prod-01 |
{{AZURE_REGION}} | Azure region | eastus2 |
{{SITE_CODE}} | Site identifier | dal |
Next Steps
After configuring the Log Analytics workspace:
- ➡️ Task 2: Configure Azure Monitor Agent — Deploy AMA to cluster nodes
- Enable data collection rules for performance and event data
- Verify data is flowing to the workspace before enabling Insights
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 |
|---|---|---|
| ← Phase 01: SDN Deployment | Phase 02: Monitoring & Observability | Task 02: Azure Monitor Agent → |
| 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 |