Task 03: Configure Security Baselines
DOCUMENT CATEGORY: Runbook
SCOPE: Security baseline configuration
PURPOSE: Review and remediate security recommendations
MASTER REFERENCE: Microsoft Learn - Security Baselines
Status: Active
Security baselines provide a standardized set of security configurations based on Microsoft best practices. This step reviews Defender for Cloud recommendations and remediates high-priority findings before Azure Local deployment.
Addressing security recommendations before deploying Arc-enabled servers and the Azure Local cluster reduces the attack surface and simplifies post-deployment hardening.
Overview
| Baseline Category | Focus Area | Priority |
|---|---|---|
| Compute | VM security, extensions, encryption | High |
| Networking | NSG rules, public access, network segmentation | High |
| Identity | RBAC, privileged accounts, MFA | High |
| Data | Encryption at rest, Key Vault configuration | Medium |
| Monitoring | Diagnostic settings, log retention | Medium |
Prerequisites
- Defender for Cloud enabled (Step 2)
- Azure Policy initiatives assigned (Step 3)
- Security Administrator role or equivalent
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.
security.baseline_settings[]: type, name, value, acknowledge_weaker_security
nodes[].name, nodes[].management.ip_address the machine to connect to (unless -ComputerName is given)
identity.local_admin.username, identity.local_admin.password
Procedure
- Azure Portal
- Orchestrated Script
Review Security Recommendations
- Navigate to Defender for Cloud
- In Azure Portal, go to Microsoft Defender for Cloud
- Click Recommendations in the left menu
- Filter by Severity
- Set Severity filter to High
- Review the list of high-severity recommendations
- Review by Resource Type
- Click Inventory to view resources
- Filter by resource type (VMs, Key Vaults, Storage, etc.)
- Click a resource to see its security findings
Remediate High-Priority Recommendations
Key Vault Recommendations
- Key Vault should use RBAC permission model
- Navigate to Key Vault → Access configuration
- Select Azure role-based access control
- Click Save
- Key Vault should have soft delete enabled
- Navigate to Key Vault → Properties
- Verify soft delete is enabled (default in new vaults)
- Key Vault should have purge protection enabled
- Navigate to Key Vault → Properties
- Enable Purge protection
Network Recommendations
- Subnets should be associated with an NSG
- Navigate to Virtual Network → Subnets
- Verify each subnet has an NSG attached
- Apply NSGs created in Stage 06
- Management ports should be protected
- Restrict the management ports with NSG rules
- Just-in-time VM access needs the paid Defender for Servers plan, which this guide does not turn on
Storage Recommendations
- Storage accounts should use private link
- Navigate to Storage account → Networking
- Configure private endpoints (if required)
- Secure transfer to storage accounts should be enabled
- Navigate to Storage account → Configuration
- Verify Secure transfer required is enabled
Export Recommendations
- Export to CSV
- In Recommendations view, click Download CSV
- Save for documentation and tracking
- Configure Continuous Export
- Go to Environment settings → Your subscription
- Click Continuous export
- Configure export to Log Analytics or Event Hub
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-04-security-governance/task-03-configure-security-baselines/powershell/Set-SecurityBaselines.ps1 | Changes the individual security baseline settings that security.baseline_settings of infrastructure.yml lists, with Set-AzsSecurity. Supports -WhatIf. |
Requires: PowerShell 7.
Run
./Set-SecurityBaselines.ps1 -InfrastructureFile ./infrastructure.yml -WhatIf
Common Recommendations for Azure Local
| Recommendation | Category | Remediation |
|---|---|---|
| Enable MFA for accounts with owner permissions | Identity | Configure Conditional Access (Step 6) |
| Subnets should be associated with NSG | Network | Apply NSGs from Stage 06 |
| Key Vault should use RBAC | Data | Update Key Vault access model |
| Storage accounts should restrict network access | Data | Configure private endpoints |
| Management ports should be protected | Network | Restrict with NSG rules |
Validation
# Get secure score
$secureScore = az security secure-score show --name ascScore | ConvertFrom-Json
Write-Host "Current Secure Score: $($secureScore.score.current) / $($secureScore.score.max)" -ForegroundColor Cyan
# Get recommendation count by status
$recommendations = az security assessment list | ConvertFrom-Json
$healthy = ($recommendations | Where-Object { $_.status.code -eq "Healthy" }).Count
$unhealthy = ($recommendations | Where-Object { $_.status.code -eq "Unhealthy" }).Count
Write-Host "`nRecommendation Status:"
Write-Host " Healthy: $healthy" -ForegroundColor Green
Write-Host " Unhealthy: $unhealthy" -ForegroundColor $(if ($unhealthy -gt 0) { "Yellow" } else { "Green" })
Expected Output
Current Secure Score: 72 / 100
Recommendation Status:
Healthy: 45
Unhealthy: 8
Secure Score Target
| Score Range | Status | Action |
|---|---|---|
| 80-100% | Excellent | Maintain current posture |
| 60-79% | Good | Address high-severity items |
| 40-59% | Fair | Prioritize remediation plan |
| 0-39% | Poor | Immediate attention required |
Secure score may take up to 24 hours to reflect changes after remediation.
Troubleshooting
| Issue | Cause | Resolution |
|---|---|---|
| Secure score not updating after remediation | Assessment cycle not yet completed | Wait up to 24 hours; force refresh by navigating to Defender for Cloud > Secure score and clicking refresh |
| Remediation script fails with authentication errors | Azure context expired or wrong subscription | Re-authenticate: Connect-AzAccount; verify context: Get-AzContext; set correct subscription |
| Recommendations show resources not in scope | Policy evaluation includes resources outside intended scope | Review assignment scope; add exclusions for out-of-scope resource groups or subscriptions |
Next Steps
Proceed to Task 5: Enable Security Logging to configure security event collection.
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 02: Azure Policy | Phase 04: Security & Governance | Task 04: Security Logging → |
| 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 |