Contributing to Azure Resource Inventory

March 28, 2025 ยท View on GitHub

Guidelines for Community Contributions

PRs Welcome Contributor Covenant

Table of Contents

Getting Started

Thank you for considering contributing to Azure Resource Inventory (ARI)! We welcome contributions from the community and are excited to see what you can bring to the project.

Before you begin, please familiarize yourself with the README.md file to understand the purpose and functionality of ARI.

If you wish to contribute by adding a new Resource Type to ARI, you may jump to the Resource Types section of this document.

Contribution Workflow

Follow these steps to contribute to ARI:

  1. Fork the Repository

    Start by forking the repository to your GitHub account using the "Fork" button at the top right of the repository page.

  2. Clone Your Fork

    git clone https://github.com/your-username/ARI.git
    cd ARI
    
  3. Create a Branch

    Create a new branch for your contribution:

    git checkout -b feature/your-feature-name
    

    Use a descriptive name that reflects your contribution.

  4. Make Your Changes

    Implement your changes, ensuring they follow the Development Guidelines.

  5. Test Your Changes

    Test your changes thoroughly to ensure they work as expected and don't break existing functionality.

  6. Commit Changes

    git add .
    git commit -m "Add feature: your feature description"
    

    Write clear, concise commit messages that describe your changes.

  7. Push to Your Fork

    git push origin feature/your-feature-name
    
  8. Submit a Pull Request

    Go to the original ARI repository and click "New Pull Request". Select your fork and branch, then provide a detailed description of your changes.

  9. Address Review Feedback

    Be responsive to any feedback provided by maintainers and make necessary changes.

Development Guidelines

To maintain code quality and consistency:

  • Follow PowerShell Best Practices: Follow Microsoft's PowerShell Best Practices
  • Document Your Code: Add comments to explain complex logic and update documentation if needed
  • Keep It Modular: Make sure your code follows the modular approach of ARI
  • Error Handling: Include appropriate error handling and logging
  • Backward Compatibility: Ensure your changes don't break existing functionality
  • Test Thoroughly: Test in various environments (Windows, Linux, Cloud Shell)

Project Structure

The main module AzureResourceInventory.psm1 is only responsible for dot sourcing all the .ps1 modules.

Public Modules

This modules will be loaded and the functions will be exposed to the user session

PublicFunctions

Script FileDescription
Invoke-ARI.ps1Entry point script to invoke Azure Resource Inventory operations.

Diagram

Script FileDescription
Build-ARIDiagramSubnet.ps1Builds diagrams for Azure subnets.
Set-ARIDiagramFile.ps1Configures the file settings for diagram generation.
Start-ARIDiagramJob.ps1Initiates the job for creating diagrams.
Start-ARIDiagramNetwork.ps1Starts the process for generating network diagrams.
Start-ARIDiagramOrganization.ps1Generates diagrams for organizational structures.
Start-ARIDiagramSubscription.ps1Creates diagrams for Azure subscriptions.
Start-ARIDrawIODiagram.ps1Generates diagrams compatible with Draw.io.

Jobs

Script FileDescription
Start-ARIAdvisoryJob.ps1Initiates the advisory-related job for ARI operations.
Start-ARIPolicyJob.ps1Starts the job for processing Azure Policy-related tasks.
Start-ARISecCenterJob.ps1Initiates the job for handling Azure Security Center insights.
Start-ARISubscriptionJob.ps1Starts the job for processing subscription-specific tasks.
Wait-ARIJob.ps1Waits for the completion of ARI jobs and monitors their status.

Private Modules

This modules will be loaded and the functions will be available for the script and other functions to consume, but will not be exposed to the user session

0.MainFunctions

Script FileDescription
Clear-ARICacheFolder.ps1Clears the ARI cache folder to ensure a clean state for operations.
Clear-ARIMemory.ps1Frees up memory used by ARI during operations.
Connect-ARILoginSession.ps1Establishes a login session with Azure for ARI operations.
Get-ARIUnsupportedData.ps1Retrieves data that is not currently supported by ARI.
Set-ARIFolder.ps1Configures the folder structure for ARI operations.
Set-ARIReportPath.ps1Sets the path for storing ARI-generated reports.
Start-ARIExtractionOrchestration.ps1Initiates the orchestration process for resource extraction.
Start-ARIProcessOrchestration.ps1Starts the orchestration of ARI's processing tasks.
Start-ARIReporOrchestration.ps1Begins the orchestration for generating ARI reports.
Test-ARIPS.ps1Tests the PowerShell environment and prerequisites for ARI operations.

1.ExtractionFunctions

Script FileDescription
Get-ARIAPIResources.ps1Extracts resources using Azure APIs.
Get-ARIManagementGroups.ps1Retrieves Azure Management Group data.
Get-ARISubscriptions.ps1Retrieves subscription details from Azure.
Invoke-ARIInventoryLoop.ps1Executes the inventory loop for resource extraction.
Start-ARIGraphExtraction.ps1Initiates the extraction of Azure Resource Graph data.

1.ExtractionFunctions/ResourceDetails

Script FileDescription
Get-ARIVMQuotas.ps1Retrieves quota details for Azure Virtual Machines.
Get-ARIVMSkuDetails.ps1Retrieves SKU details for Azure Virtual Machines.

2.ProcessingFunctions

Script FileDescription
Build-ARICacheFiles.ps1Builds cache files for ARI operations.
Invoke-ARIAdvisoryJob.ps1Executes advisory-related processing jobs.
Invoke-ARIDrawIOJob.ps1Executes jobs for generating Draw.io diagrams.
Invoke-ARIPolicyJob.ps1Executes policy-related processing jobs.
Invoke-ARISecurityCenterJob.ps1Executes jobs related to Azure Security Center insights.
Invoke-ARISubJob.ps1Executes subscription-specific processing jobs.
Start-ARIAutProcessJob.ps1Initiates automated processing jobs for ARI.
Start-ARIExtraJobs.ps1Starts additional processing jobs for extended functionality.
Start-ARIProcessJob.ps1Initiates the main processing jobs for ARI operations.

3.ReportingFunctions

Script FileDescription
Build-ARIAdvisoryReport.ps1Generates advisory reports based on processed data.
Build-ARIPolicyReport.ps1Generates policy compliance reports.
Build-ARIQuotaReport.ps1Generates quota usage reports.
Build-ARISecCenterReport.ps1Generates reports for Azure Security Center insights.
Build-ARISubsReport.ps1Generates subscription-specific reports.
Start-ARIExcelJob.ps1Initiates Excel-related reporting jobs.
Start-ARIExtraReports.ps1Starts additional reporting jobs for extended functionality.

3.ReportingFunctions/StyleFunctions

Script FileDescription
Build-ARIExcelChart.ps1Creates Excel charts for visualizing report data.
Build-ARIExcelComObject.ps1Manages Excel COM objects for report generation.
Build-ARIExcelinitialBlock.ps1Sets up the initial block for Excel report customization.
Out-ARIReportResults.ps1Outputs the final report results to Excel or other formats.
Retirement.kqlContains KQL queries for data retirement analysis.
Start-ARIExcelCustomization.ps1Customizes Excel reports with specific formatting and styles.
Start-ARIExcelOrdening.ps1Orders and organizes data in Excel reports.
Support.jsonProvides configuration or metadata support for reporting functions.

Each module is designed to handle specific tasks, ensuring a clean and modular approach to ARI's functionality.

Resource Types

Resource Type Modules

The supported resource types by Azure Resource Inventory are defined by the "Resource Type Modules", we made sure to create this structure to be as simple as possible.

So anyone could contribute by creating new modules for new resource types.

There is a Resource Type Module file for every single resource type supported by ARI, the structure of resource type module itself is explained in the "Module-template.tpl", located in Modules/Public/InventoryModules.

Once you create the module file, it must be placed in the correct folder structure under Modules/Public/InventoryModules. The subfolder structure follows the official Azure documentation for Resource Providers: azure-services-resource-providers

Resource Type Subfolders

CategoryDescription
AIScripts for processing AI services like Azure AI, Computer Vision, and more.
AnalyticsScripts for processing analytics services like Databricks, Data Explorer, and Purview.
APIsScripts for processing data captured through REST APIs.
ComputeScripts for processing compute resources such as VMs and VM Scale Sets.
ContainerScripts for processing container resources like AKS and Azure Container Instances.
DatabaseScripts for processing database services like SQL, MySQL, and Cosmos DB.
HybridScripts for processing hybrid cloud resources like Azure Arc.
IntegrationScripts for processing service integration resources like Logic Apps and Service Bus.
IoTScripts for processing IoT resources like IoT Hub and Azure Digital Twins.
ManagementScripts for processing management and governance resources like Azure Policy.
MonitoringScripts for processing monitoring services like Azure Monitor and Log Analytics.
Network_1Scripts for processing core networking resources like VNets and NSGs.
Network_2Scripts for processing advanced networking resources like Azure Firewall and WAF.
SecurityScripts for processing security services like Azure Security Center and Sentinel.
StorageScripts for processing Azure Storage services like Blob, File, and Queue.
WebScripts for processing web services like App Services and Azure Functions.

Getting Help

If you have questions or need help with your contribution:

  • Open an Issue: Create a new issue in the GitHub repository
  • Documentation: Refer to the README.md and other documentation
  • Community Discussions: Check existing discussions in the Issues tab

Thank you for contributing to Azure Resource Inventory! Your efforts help make cloud administration easier for the entire Azure community.