Giter VIP home page Giter VIP logo

azure-mg-sub-governance-reporting's Introduction

AzGovViz - Azure Governance Visualizer

Do you want to have visibility on your Tenant´s Management Group hierarchy - document it in csv, html and markdown? This script iterates your Tenant´s Management Group hierarchy down to Subscription level. It captures most relevant Azure governance capabilities and creates a visible hierarchy.

You can run the script either for your Tenant Root Group or any other Management Group that you have read access on.

AzGovViz Version 2

The new version comes with a handful of enhancements:

  • Optimized user experience for the HTML output
  • Summary for Tenant / selected Management Group scope
  • Reflect Tenant, ManagementGroup and Subscription Limits for Azure Governance capabilities
  • Some security related best practice highlighting
  • More details: Management Groups, Subscriptions, Policies, Policy Sets (Initiatives), Orphaned Policies, RBAC and Policy related RBAC (DINE MI), Orphaned Roles, Orphaned RoleAssignments, Blueprints, Subscription State, Subscription QuotaId, Subscription Tags, Azure Scurity Center Secure Score, ResourceGroups count, Resource types and count by region, Limits, Security findings
  • Resources / leveraging Azure Resource Graph
  • Parameter based output (hierarchy only, 'srubbed' user information and more..)
  • HTML version check

Demo

AzGovViz Demo

Screenshots

detailed html file

alt text *IDs from screenshot are randomized

basic markdown in Azure DevOps Wiki

alt text *IDs from screenshot are randomized

Outputs

  • CSV file
  • HTML file
    • the html file uses Java Script and CSS files which are hosted on various CDNs (Content Delivery Network). For details review the BuildHTML region in the AzGovViz.ps1 script file.
    • Browsers tested: Edge, new Edge and Chrome
  • MD (markdown) file
    • for use with Azure DevOps Wiki leveraging the Mermaid plugin

note: there is some fixing ongoing at the mermaid project to optimize the graphical experience:
mermaid-js/mermaid#1289
mermaid-js/mermaid#1177

Required permissions in Azure

  • RBAC Role: Reader on Management Group level
  • API permissions: If you run the script in Azure Automation or on Azure DevOps hosted agent you will need to grant API permissions in Azure Active Directory (get-AzRoleAssignment cmdlet requirements). The Automation Account or Service Connection App registration (Application) must be granted with: Azure Active Directory API | Application | Directory | Read.All (admin consent might be required)

Usage

PowerShell

  • Requires PowerShell Az Modules
    • Az.Accounts
    • Az.Resources
    • Az.ResourceGraph
  • Usage
    • .\AzGovViz.ps1 -managementGroupId <your-Management-Group-Id>
  • Parameters
    • ManagementGroupId
    • CsvDelimiter (the world is split into two kind of delimiters - comma and semicolon - choose yours)
    • OutputPath
    • AzureDevOpsWikiAsCode
    • DoNotShowRoleAssignmentsUserData (scrub user information)
    • LimitCriticalPercentage (limit warning level, default is 80%)
    • HierarchyTreeOnly (output only the hierarchy tree for Management Groups including linked Subscriptions)
    • UseAzureRM parameter support for AzureRm modules has been deprecated
  • Passed tests: Powershell Core on Windows
  • Passed tests: Powershell 5.1.18362.752 on Windows
  • Passed tests: Powershell Core on Linux Ubuntu 18.04 LTS

Azure DevOps Pipeline

The provided example Pipeline is configured to run based on a shedule (every 6 hours). It will push the AzGovViz markdown output file to the wikiRepo which will feed your Wiki.

  1. In Azure DevOps make sure to enable the Multistage Pipelines feature https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started/multi-stage-pipelines-experience?view=azure-devops
  2. Clone the AzGovViz Repo
  3. Create an additional Repo 'wikiRepo' (hosting AzGovViz outputs)
  4. Create Wiki by choosing Publish Code as Wiki, define the Repo 'wikiRepo' as source
  5. Create Pipeline, configure your pipeline selecting Existing Azure Pipelines YAML file, select the AzGovViz YAML from the AzGovViz (Azure-MG-Sub-Governance-Reporting) Repo
  6. Permissions: In order to allow the pipeline to push files to our wikiRepo the Project Collection Build Service(%ORGNAME%) must be granted Contribute and Create Branch permissions

The Project Collection Build Service(%ORGName%) seems only to become available after at least one pipeline has run - so just trigger the pipeline, expect an error and after the run grant the permissions as pointed out in 6.
Make sure your Service Connection has the required permissions (see Required permissions in Azure).

Security

AzGovViz creates very detailed information about your Azure Governance setup. In your organizations best interest the outputs should be protected from not authorized access!

Facts

Subscriptions where QuotaId starts with with "AAD_" are being skipped, all others are queried (https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/understand-cost-mgt-data#supported-microsoft-azure-offers).

Limits are not acquired programmatically, they are hardcoded. The links used to check related Limits are commented in the param section of the script.

Contributions

Please feel free to contribute. Thanks to so many supporters - testing, giving feedback, making suggestions, presenting use-case, posting/blogging articles, refactoring code - THANK YOU!

Special thanks to Tim Wanierke, Brooks Vaughn, Friedrich Weinmann

AzAdvertizer

Also check https://www.azadvertizer.net to keep up with the pace on Azure Governance capabilities such as Azure Policies, Policy Initiatives, Policy Aliases, RBAC Roles and Resource Providers including operations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.