Azure Governance Visualizer (AzGovViz)

repository·master·Indexed 21 days ago

https://github.com/julianhayward/azure-mg-sub-governance-reporting

A PowerShell tool for auditing and visualizing Azure Management Group hierarchies, RBAC, and Azure Policy configurations. AzGovViz provides insights into technical governance implementations, including hierarchy mapping, orphaned policy and role detection, ALZ policy alignment (introduced in v6.7.0), and ARM limit monitoring. It exports data via HTML, CSV, JSON, and Markdown, and includes cost optimization features via the -DoAzureConsumption parameter to identify unused resources.

Tokens
9K
Snippets
19
Records
45
Agent score
72%

What's inside AzGovViz

  1. Overview of Azure Governance Visualizer (AzGovViz)

    master

    Azure Governance Visualizer (AzGovViz) is a PowerShell-based tool designed to provide granular insights into technical Azure Governance implementations. It iterates through the Azure Tenant's Management Group hierarchy—from the root Management Group down to Subscriptions, Resource Groups, and individual Resources—collecting data via Azure ARM, Microsoft Graph, and Storage APIs.

    Key Capabilities:

    • Hierarchy Visualization: Generates an HTML output containing a HierarchyMap and TenantSummary.
    • Governance Insights: Provides DefinitionInsights and granular ScopeInsights for Management Groups and Subscriptions, specifically covering Azure Policy and RBAC.
    • Data Export: Produces enriched CSV files for capability-specific data and detailed JSON files documenting Management Groups, Subscriptions, Azure RBAC (definitions and assignments), and Azure Policy (definitions and assignments).
    • Use Cases: Ideal for change tracking, tenant migration (redeployment of configuration), and creating governance backups.
  2. Identify Azure ARM Limits and Thresholds

    master

    AzGovViz helps prevent governance failures by identifying when your tenant or Management Groups are approaching Azure Resource Manager (ARM) limits.

    Monitored limits include:

    • Tenant-level limits: Custom role definitions and PolicySet definitions.
    • Management Group-level limits: Policy assignment limits, Policy/PolicySet definition scope limits, and role assignment limits.
    • Subscription-level limits: Resource group limits, subscription tag limits, policy assignment limits, Policy/PolicySet definition scope limits, and role assignment limits.
  3. Monitor Subscriptions, Resources, and Cost

    master

    AzGovViz provides operational and cost-optimization insights for your Azure environment.

    Key capabilities include:

    • Subscription Insights: Tracks state, quotas, role assignment limits, tags, Microsoft Defender for Cloud secure scores, and cost.
    • Resource Management:
      • Fluctuation Tracking: Reports on resources added or removed since the previous execution (available in HTML and CSV).
      • Lock Analysis: Aggregates insights on resource locks and provides detailed CSV exports of locks applied at specific scopes.
      • Tagging: Provides insights into tag name usage across subscriptions and resources.
    • Cost Optimization: When running with the -DoAzureConsumption parameter, the tool identifies orphaned/unused resources with an intent of cost savings. It specifically flags virtual machines that are stopped but not deallocated, as these still incur compute costs.
    • Microsoft Defender for Cloud: Summarizes coverage by plan/tier and highlights the usage of deprecated Defender plans (e.g., Container Registry & Kubernetes).
  4. How the ALZ Policy Assignments Checker works

    master

    The ALZPolicyAssignmentsChecker is a feature introduced in version 6.7.0. It compares your currently deployed Azure Landing Zone (ALZ) hierarchy against ALZ archetype definitions to identify missing policy assignments. When a discrepancy is found, it references the missing policy assignment payloads and provides AzAdvertizer links for remediation.

    To use this feature, you must provide the Management Group IDs of your deployed ALZ hierarchy using the -ALZManagementGroupsIds parameter.

    # Example usage (parameters details found in the Parameters section of the full documentation)
    ./AzGovViz.ps1 -ALZPolicyAssignmentsChecker -ALZManagementGroupsIds @("ID-1", "ID-2")
  5. Analyze Azure Policy and Compliance

    master

    Azure Governance Visualizer (AzGovViz) provides deep visibility into Azure Policy configurations and compliance states across Management Groups, subscriptions, and resource groups.

    Key capabilities include:

    • Policy Definition Analysis: Identifies custom policy definitions, their scope, effects (including DINE/Modify), and usage in PolicySets. It also identifies orphaned custom policy definitions (those not used in any PolicySet or assignment).
    • Exemption Tracking: Lists all policy exemptions, enriches scope information, and summarizes expired exemptions.
    • Assignment Monitoring: Detects orphaned policy assignments (where the underlying definition no longer exists) and provides enriched data on assignment scope, inheritance, and compliance status (Compliant, NonCompliant, or Conflicting).
    • ALZ Alignment: Includes an Azure Landing Zone (ALZ) policy version checker and policy assignment checker. It clones the ALZ GitHub repository to compare your tenant's policies/assignments against the official ALZ definitions, providing lifecycle management recommendations and a *_ALZPolicyVersionChecker.csv export.
    • Remediation: Lists all remediable policies with necessary assignment and definition data.
  6. Analyze Azure RBAC and Identity Permissions

    master

    AzGovViz provides holistic insights into Role-Based Access Control (RBAC) and Microsoft Entra ID identities.

    Key capabilities include:

    • Role Definition & Assignment Analysis: Identifies custom role definitions, their assignable scopes, and orphaned custom role definitions (unused in assignments or policy rules). It also detects orphaned role assignments (where the role or target identity was deleted).
    • Identity Resolution: For group assignments, it fully resolves Microsoft Entra group members and reports transitive member counts. For Service Principals, it reveals the specific type (Application vs. ManagedIdentity). For Users, it reveals the userType (Member vs. Guest).
    • PIM (Privileged Identity Management): Generates reports on PIM-eligible role assignments for Management Groups and subscriptions.
      • 💡 Note: This requires executing as a service principal with the Application API permission PrivilegedAccess.Read.AzureResources.
    • Security Best Practices: Analyzes high-privilege risks, such as 'Owner' permissions on Service Principals, 'User Access Administrator' permissions on non-group identities, and high-privilege roles assigned to Guest Users.
    • Managed Identity Insights: Summarizes user-assigned managed identities, their resource assignments, and identifies orphaned managed identities related to non-existent policy assignments.
  7. Create the Azure DevOps pipeline

    master

    To set up the automation for Azure Governance Visualizer, create a new pipeline in Azure DevOps using the existing YAML configuration provided in the repository.

    1. Open your project in Azure DevOps.
    2. Navigate to Pipelines and click New pipeline.
    3. Select Azure Repos Git as the source.
    4. Select the Azure Governance Visualizer repository.
    5. Choose Existing Azure Pipelines YAML file.
    6. Set the Path to /.azuredevops/pipelines/AzGovViz.pipeline.yml.
    7. Click Save.
    /* Path to the pipeline configuration file */
    /.azuredevops/pipelines/AzGovViz.pipeline.yml
  8. Import Azure Governance Visualizer into a GitHub repository

    master

    To orchestrate regular execution of Azure Governance Visualizer using GitHub Actions, first import the repository into your GitHub organization as a private repository.

    1. Go to GitHub Import.
    2. Use https://github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting.git as the clone URL.
    3. Select your existing GitHub organization.
    4. Select Private.
    5. Click Begin import.
    https://github.com/JulianHayward/Azure-MG-Sub-Governance-Reporting.git
  9. Manually set up an Azure Web App for AzGovViz

    master

    To host the Azure Governance Visualizer HTML output for business-wide visibility, you can manually deploy an Azure Web App.

    1. Deploy a Web App: Create a new Web App on Azure. You can use the smallest or FREE SKU, and the platform (Windows or Linux) does not matter.
    2. Configure Runtime: During setup, select the runtime stack used by your organization.
    3. Set Default Document: In the Web App's Configuration blade, add the name of your HTML output file to the Default Documents list so the report loads automatically when visiting the URL.
    4. Enable Authentication: Ensure you configure Authentication on the Web App to secure the governance data.
    5. Tagging: It is recommended to tag the resource for operational and financial tracking.
  10. Enable Cost Optimization via `-DoAzureConsumption`

    master

    To enable the cost optimization and cleanup feature, you must include the -DoAzureConsumption parameter during execution. This activates the identification of orphaned or unused resources that can lead to cost savings, based on Azure Orphan Resources ARG queries.

    Specifically, it will flag:

    • Orphaned/unused resources with intent cost savings.
    • Virtual machines that are in a stopped state but not deallocated (intent: cost savings - stopped but not deallocated VM).
    # Example usage to enable cost optimization (actual command structure depends on the CLI/module implementation)
    azgovviz -DoAzureConsumption