How lcarli/landingzoneassessment-automate works
Project Type and Purpose
• This is an open-source Azure Landing Zone Assessment Automation tool written in PowerShell.
• It automates evaluation of Azure Landing Zones, collects data via Azure Resource Graph and Microsoft Graph, applies checklist logic, and generates both JSON reports and an interactive web dashboard.
Major Components
a. Infrastructure as Code (ARM & Bicep)
• arm/main.json – Azure Resource Manager template for deploying prerequisites (e.g., Log Analytics workspace, storage account, web app).
• bicep/main.bicep – Bicep version of the same IaC.
b. Execution Scripts (scripts/)
• Initialize.ps1 – authentication, module installation, global context setup.
• Main.ps1 – orchestrator that loads config, exceptions, invokes assessment modules, and writes outputs.
• CreateWebSite.ps1 – provisions or updates the interactive dashboard site using Az.Websites.
• CompareChecklist.ps1 – utility for JSON checklist diff (optional).
c. Assessment Modules (functions/)
• Eight self-contained .ps1 files, one per design area (Billing, IAM, ResourceOrganization, Network, Governance, Security, DevOps, Management).
• Each module dot-sources shared utilities and returns standardized result objects.
d. Shared Libraries (shared/)
• SharedFunctions.ps1 – common helper routines (caching, resource queries).
• ErrorHandling.ps1 – centralized Write-ErrorLog implementation.
• Enums.ps1 – Status enum definitions for consistency.
• Configuration files (config.json, alz_checklist.en.json, exceptions.json)
e. Outputs and Artifacts
• reports/ – Generated JSON report(s) and error logs.
• logs/ – PowerShell transcript logs.
• web/ – Static/HTML dashboard content (index.html, styles.css).
f. Debug Utilities (Debug/)
• DebugFunctions.ps1 and scripts for deep troubleshooting.
External Dependencies and Services
• Azure Resource Graph API (for inventory queries)
• Microsoft Graph PowerShell modules (for Entra ID data)
• Azure PowerShell modules (Az.Accounts, Az.Resources, Az.Network, etc.)
• Azure Web App or Storage static website hosting (deployed via ARM/Bicep)
Interactions and Data Flow
1. User runs Initialize.ps1 → authenticates to Azure and Microsoft Graph → populates $global:AzData and $global:GraphData.
2. Main.ps1 loads shared/config.json and alz_checklist.en.json, applies exceptions.json.
3. For each enabled design area, Main.ps1 calls the corresponding functions/*.ps1 module → collects results and raw evidence.
4. SharedFunctions cache and error handling utilities support all module executions.
5. After collecting all results, Main.ps1 writes a combined JSON report to reports/report.json and logs to logs/.
6. CreateWebSite.ps1 is invoked to push or update web/index.html and assets to Azure web hosting.
7. End users open the interactive dashboard in a browser to view charts, tables, and exception overrides.
Architectural Patterns and Principles
• Modular Design: Each design area is a self-contained PowerShell module.
• Shared Context Pattern: $global:AzData and $global:GraphData act as in-memory caches.
• Centralized Error Handling: All errors funnel through Write-ErrorLog in shared/ErrorHandling.ps1.
• Standardized Result Objects: Uniform result structure defined by Set-EvaluationResultObject and Status enum.
• Infrastructure-as-Code: ARM/Bicep templates for provisioning host environment.