Automated Azure Policy Compliance Monitoring
Monitor and compare your Azure Policy initiatives (Management Group) with Microsoft baselines (ALZ & MCSB). Generate monthly HTML reports with visual analysis and actionable CSV exports.
AzurePolicyWatch is based on references published by AzAdvertizer and the Microsoft Cloud Security Benchmark (MCSB) to provide recommendations aligned with Microsoft best practices.
We are not responsible for content published by these third-party sources. AzurePolicyWatch is an analysis and comparison tool that aggregates this public information for Azure compliance and governance purposes.
AzurePolicyWatch is a modular and tested PowerShell tool that automates Azure Policy governance by:
- π₯ Aggregating public baselines (ALZ via AzAdvertizer + MCSB via Azure)
- π Comparing these baselines with your actually assigned initiatives
- π Generating interactive HTML reports and hierarchical CSV exports
- π€ Committing results automatically to monthly dated folders
- π― Identifying missing, extra, or version-mismatched policies
Perfect for: Compliance audits, ALZ alignment, MCSB tracking, continuous governance.
- Interactive HTML report with dynamic filters (status, deprecated, preview)
- Color-coded tables by effect (Deny=red, DeployIfNotExists=green, Audit=blue)
- Hierarchical CSV (Initiative β Policies) for Excel/PowerBI
- Monthly snapshots archived in
inventory/YYYY_MM/ - Animated logo watermark with breathing effect in hero section
- Modern design with clean light gray background and responsive layout
- β Matched: Policies compliant with baseline
- β Missing: Recommended policies not deployed
- βΉοΈ Extra: Custom policies outside baseline
β οΈ Version Mismatch: Policies with incorrect version- π·οΈ Lifecycle: Detection of Deprecated/Preview status
- π Scoring: Global, ALZ and MCSB scores with detailed metrics
- π’ Matched β Policies deployed and matching the ALZ/MCSB baseline
- π΄ Missing β Baseline policies not deployed in your environment
- π‘ Version Mismatch β Policies with different version than baseline
- π΅ Extra β Custom initiatives/policies not in ALZ/MCSB baseline (no impact on score)
| Column | Description |
|---|---|
| AssignmentDisplayName | Display name of the policy assignment |
| AssignmentName | Technical name of the assignment |
| AssignmentScope | Scope where the assignment is applied (MG/Subscription) |
| InitiativeDefinitionId | ID of the initiative definition (or "N/A" for individual policies) |
| TotalPolicies_Assignment | Total number of policies in the initiative |
| InCommon | Policies that match the ALZ/MCSB baseline (counted in score) |
| ExtraInAssignment_Count | Policies not in baseline (not counted in score) |
| VersionDiffs_Count | Policies with version mismatch vs baseline |
| AssignmentStatus | Status: Matched (green) or Extra (blue) |
| Column | Description |
|---|---|
| PolicyDisplayName | Display name of the baseline policy |
| PolicyDefinitionId | Azure resource ID of the policy definition |
| Version | Version of the policy in baseline |
| PolicyType | Type: BuiltIn or Custom |
| BaselineSources | Source baseline: ALZ, MCSB, or both |
| AssignmentStatus | Status: Matched (deployed) or Missing (not deployed) |
| Effect | Policy effect (Audit, Deny, DeployIfNotExists, etc.) |
- ποΈ ALZ Score: 36.7% (190/510 policies)
- π MCSB Score: 89.4% (202/234 policies)
- π― Global Score: 52.7% (392/744 policies)
- π Global search (name / ID / text) β full-text search with debounce (180ms for fluidity)
- π― Status filters β filter views on All/ Matched / Missing / Extra
- π·οΈ Lifecycle masking β hide policies marked Deprecated or Preview
- π¨ Contextual coloring β rows and badges colored by effect and lifecycle for instant visual recognition
- π± Responsive design β optimized for desktop, tablet, and mobile
| Component | Version | Usage |
|---|---|---|
| PowerShell | 7.0+ | Script execution |
| Az.Accounts | Latest | Azure connection |
| Az.Resources | Latest | Policy retrieval |
#Import Powershell Gallery
Install-Module -Name AzurePolicyWatch -AllowPrerelease
# Connect to Azure
Connect-AzAccount -TenantId "<TENANT_ID>"
# Run with Management Group (recommended)
Invoke-AzPolicyWatch -ManagementGroupId "MyMG" -HtmlReport
# Or with Subscription
Invoke-AzPolicyWatch -SubscriptionId "SubID" -HtmlReport
# Custom output folder
Invoke-AzPolicyWatch `
-ManagementGroupId "MyMG" `
-OutputFolder "C:\Reports\PolicyCompliance" `
-HtmlReport `
-VerboseInvoke-AzPolicyWatch [
# Scope (choose one)
-ManagementGroupId <String> # Management Group ID
-SubscriptionId <String> # Subscription ID
# Output options
-OutputFolder <String> # Default: C:\Temp\Policy-Compare
-HtmlReport # Generate HTML report
# Baseline filtering
-ExcludeBaselineTypes <String[]> # Exclude baselines: @("ALZ"), @("MCSB"), or @("ALZ","MCSB")
# Branding (optional)
-ProjectName <String> # Default: AzurePolicyWatch
-ProjectVersion <String> # Default: 1.0.1
-LogoPath <String> # Path to logo image
# Execution options
-Quiet # Suppress progress messages
-Verbose # Show detailed logs
]#Import Powershell Gallery
Install-Module -Name AzurePolicyWatch -AllowPrerelease
# Example 1: Basic usage with HTML report
Invoke-AzPolicyWatch -ManagementGroupId "MyMG" -HtmlReport
# Example 2: Subscription scope with custom output
Invoke-AzPolicyWatch `
-SubscriptionId "SubID" `
-OutputFolder ".\reports\$(Get-Date -Format 'yyyy-MM')" `
-HtmlReport `
-Verbose
# Example 3: Quiet mode (minimal output)
Invoke-AzPolicyWatch -ManagementGroupId "MyMG" -HtmlReport -Quiet
# Example 4: Exclude ALZ baseline from subscription analysis
Invoke-AzPolicyWatch `
-SubscriptionId "SubID" `
-HtmlReport `
-ExcludeBaselineTypes @("ALZ") `
-Quiet
# Example 5: Exclude MCSB baseline from subscription analysis
Invoke-AzPolicyWatch `
-SubscriptionId "SubID" `
-HtmlReport `
-ExcludeBaselineTypes @("MCSB")
# Example 6: Exclude ALZ baseline from Management Group analysis
Invoke-AzPolicyWatch `
-ManagementGroupId "MyMG" `
-HtmlReport `
-ExcludeBaselineTypes @("ALZ")
# Example 7: Exclude MCSB baseline from Management Group analysis (quiet mode)
Invoke-AzPolicyWatch `
-ManagementGroupId "MyMG" `
-HtmlReport `
-ExcludeBaselineTypes @("MCSB") `
-Quiet
# Example 8: Compare only against ALZ (exclude MCSB)
Invoke-AzPolicyWatch `
-ManagementGroupId "MyMG" `
-HtmlReport `
-ExcludeBaselineTypes @("MCSB") `
-Verbose
After execution, you'll find these files in the output folder:
C:\Temp\Policy-Compare\
βββ reports\
βββ π Baseline_ALZ_MCSB_Policies.csv
βββ π Baseline_Compare_Summary.csv
βββ π Baseline_Compare_Details.csv
βββ ποΈ Hierarchical_Initiatives_Policies.csv
βββ π Baseline_Compare_Report.html
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π°οΈ AzurePolicyWatch v1.0.1
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π₯ Step 1/4: Loading baseline policies...
β
ALZ baseline loaded: 510 policies
β
MCSB baseline loaded: 234 policies
β
Combined baseline: 744 unique policies
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Step 2/4: Scanning Azure assignments...
β
Found 26 initiatives
β
Found 741 individual policies
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βοΈ Step 3/4: Comparing policies...
β
Comparison completed
π Global Score: 33.1%
ββ ποΈ ALZ Score: 17.0% (87/510 policies)
ββ π MCSB Score: 69.9% (159/234 policies)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Step 4/4: Generating reports...
β
Baseline exported: Baseline_ALZ_MCSB_Policies.csv
β
Summary exported: Baseline_Compare_Summary.csv
β
Details exported: Baseline_Compare_Details.csv
β
Hierarchical CSV exported: Hierarchical_Initiatives_Policies.csv
ββ Total rows: 746
ββ Initiatives: 5
ββ Policies: 741
π Generating HTML report...
β
HTML report generated: Baseline_Compare_Report.html
β
Reports generated successfully
π Location: C:\Temp\Policy-Compare
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β¨ Analysis completed successfully!
| Resource | Link |
|---|---|
| Architecture | docs/architecture.md |
| Usage Guide | docs/usage-guide.md |
| Tests | tests/README.md |
| Azure Landing Zones | aka.ms/alz |
| MCSB Baseline | Microsoft Cloud Security Benchmark |
| AzAdvertizer | www.azadvertizer.net |
| Azure Policy Docs | learn.microsoft.com/azure/governance/policy |
This project is licensed under the MIT License - see the LICENSE file for details.
β Star this project if you find it useful! β
Made with β€οΈ for Azure Governance
