├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question-.md ├── PULL_REQUEST_TEMPLATE │ └── documentation.md ├── policies │ └── resourceManagement.yml └── workflows │ ├── azure-inventory.yml │ ├── documentation.yml │ └── stale.yml ├── .gitignore ├── AzureResourceInventory.psd1 ├── AzureResourceInventory.psm1 ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── HowTo.md ├── LICENSE ├── Modules ├── Private │ ├── 0.MainFunctions │ │ ├── Clear-ARICacheFolder.ps1 │ │ ├── Clear-ARIMemory.ps1 │ │ ├── Connect-ARILoginSession.ps1 │ │ ├── Get-ARIUnsupportedData.ps1 │ │ ├── Remove-ARIExcelProcess.ps1 │ │ ├── Set-ARIFolder.ps1 │ │ ├── Set-ARIReportPath.ps1 │ │ ├── Start-ARIExtractionOrchestration.ps1 │ │ ├── Start-ARIProcessOrchestration.ps1 │ │ ├── Start-ARIReporOrchestration.ps1 │ │ └── Test-ARIPS.ps1 │ ├── 1.ExtractionFunctions │ │ ├── Get-ARIAPIResources.ps1 │ │ ├── Get-ARICostInventory.ps1 │ │ ├── Get-ARIManagementGroups.ps1 │ │ ├── Get-ARISubscriptions.ps1 │ │ ├── Invoke-ARIInventoryLoop.ps1 │ │ ├── ResourceDetails │ │ │ ├── Get-ARIVMQuotas.ps1 │ │ │ └── Get-ARIVMSkuDetails.ps1 │ │ └── Start-ARIGraphExtraction.ps1 │ ├── 2.ProcessingFunctions │ │ ├── Build-ARICacheFiles.ps1 │ │ ├── Invoke-ARIAdvisoryJob.ps1 │ │ ├── Invoke-ARIDrawIOJob.ps1 │ │ ├── Invoke-ARIPolicyJob.ps1 │ │ ├── Invoke-ARISecurityCenterJob.ps1 │ │ ├── Invoke-ARISubJob.ps1 │ │ ├── Start-ARIAutProcessJob.ps1 │ │ ├── Start-ARIExtraJobs.ps1 │ │ └── Start-ARIProcessJob.ps1 │ ├── 3.ReportingFunctions │ │ ├── Build-ARIAdvisoryReport.ps1 │ │ ├── Build-ARIPolicyReport.ps1 │ │ ├── Build-ARIQuotaReport.ps1 │ │ ├── Build-ARISecCenterReport.ps1 │ │ ├── Build-ARISubsReport.ps1 │ │ ├── Start-ARIExcelExtraData.ps1 │ │ ├── Start-ARIExcelJob.ps1 │ │ ├── Start-ARIExtraReports.ps1 │ │ └── StyleFunctions │ │ │ ├── Build-ARIExcelChart.ps1 │ │ │ ├── Build-ARIExcelComObject.ps1 │ │ │ ├── Build-ARIExcelinitialBlock.ps1 │ │ │ ├── Out-ARIReportResults.ps1 │ │ │ ├── Retirement.kql │ │ │ ├── Start-ARIExcelCustomization.ps1 │ │ │ ├── Start-ARIExcelOrdening.ps1 │ │ │ └── Support.json │ ├── 4.RAMPFunctions │ │ ├── Export-ARIFedRamp.ps1 │ │ ├── Export-ARIStateRamp.ps1 │ │ ├── FedRAMP-Inventory-Template.xlsx │ │ ├── Start-ARIMappingFedRAMP.ps1 │ │ ├── Start-ARIMappingStateRAMP.ps1 │ │ ├── Start-ARIProcessGovRAMP.ps1 │ │ └── StateRAMP-Inventory-Template.xlsx │ └── LegacyFunctions │ │ ├── Build-ARILargeReportResources.ps2 │ │ ├── Start-ARIAutResourceJob.ps2 │ │ ├── Start-ARILargeEnvOrderFiles.ps2 │ │ ├── Start-ARIResourceJobs.ps2 │ │ ├── Start-ARIResourceReporting.ps2 │ │ └── VisioDiagram.ps2 └── Public │ ├── InventoryModules │ ├── AI │ │ ├── AzureAI.ps1 │ │ ├── ComputerVision.ps1 │ │ ├── ContentModerator.ps1 │ │ ├── ContentSafety.ps1 │ │ ├── CustomVision.ps1 │ │ ├── FaceAPI.ps1 │ │ ├── FormRecognizer.ps1 │ │ ├── HealthInsights.ps1 │ │ ├── ImmersiveReader.ps1 │ │ ├── MachineLearning.ps1 │ │ ├── SearchServices.ps1 │ │ ├── SpeechService.ps1 │ │ ├── TextAnalytics.ps1 │ │ └── Translator.ps1 │ ├── APIs │ │ ├── AdvisorScore.ps1 │ │ ├── ManagedIds.ps1 │ │ ├── Outages.ps1 │ │ ├── ReservationRecom.ps1 │ │ └── SupportTickets.ps1 │ ├── Analytics │ │ ├── DataExplorerCluster.ps1 │ │ ├── Databricks.ps1 │ │ ├── EvtHub.ps1 │ │ ├── Purview.ps1 │ │ ├── Streamanalytics.ps1 │ │ └── Synapse.ps1 │ ├── Compute │ │ ├── AVD.ps1 │ │ ├── AvailabilitySets.ps1 │ │ ├── CloudServices.ps1 │ │ ├── VMDisk.ps1 │ │ ├── VMWare.ps1 │ │ ├── VirtualMachine.ps1 │ │ └── VirtualMachineScaleSet.ps1 │ ├── Container │ │ ├── AKS.ps1 │ │ ├── ARO.ps1 │ │ ├── ContainerApp.ps1 │ │ ├── ContainerAppEnv.ps1 │ │ ├── ContainerGroups.ps1 │ │ └── ContainerRegistries.ps1 │ ├── Database │ │ ├── CosmosDB.ps1 │ │ ├── MariaDB.ps1 │ │ ├── MySQL.ps1 │ │ ├── MySQLflexible.ps1 │ │ ├── POSTGRE.ps1 │ │ ├── POSTGREFlexible.ps1 │ │ ├── RedisCache.ps1 │ │ ├── SQLDB.ps1 │ │ ├── SQLMI.ps1 │ │ ├── SQLMIDB.ps1 │ │ ├── SQLPOOL.ps1 │ │ ├── SQLSERVER.ps1 │ │ └── SQLVM.ps1 │ ├── Hybrid │ │ └── ARCServers.ps1 │ ├── Integration │ │ ├── APIM.ps1 │ │ └── ServiceBUS.ps1 │ ├── IoT │ │ └── IOTHubs.ps1 │ ├── Management │ │ ├── AutomationAccounts.ps1 │ │ ├── Backup.ps1 │ │ └── RecoveryVault.ps1 │ ├── Module-template.tpl │ ├── Monitoring │ │ ├── AppInsights.ps1 │ │ └── Workspaces.ps1 │ ├── Network_1 │ │ ├── BastionHosts.ps1 │ │ ├── Connections.ps1 │ │ ├── ExpressRoute.ps1 │ │ ├── LoadBalancer.ps1 │ │ ├── NATGateway.ps1 │ │ ├── PublicDNS.ps1 │ │ ├── RouteTables.ps1 │ │ ├── TrafficManager.ps1 │ │ ├── VirtualNetwork.ps1 │ │ └── vNETPeering.ps1 │ ├── Network_2 │ │ ├── ApplicationGateways.ps1 │ │ ├── AzureFirewall.ps1 │ │ ├── Frontdoor.ps1 │ │ ├── NetworkInterface.ps1 │ │ ├── NetworkSecurityGroup.ps1 │ │ ├── PrivateDNS.ps1 │ │ ├── PrivateEndpoint.ps1 │ │ ├── PublicIP.ps1 │ │ ├── VirtualNetworkGateways.ps1 │ │ └── VirtualWAN.ps1 │ ├── Security │ │ └── Vault.ps1 │ ├── Storage │ │ ├── NetApp.ps1 │ │ └── StorageAccounts.ps1 │ └── Web │ │ ├── APPServicePlan.ps1 │ │ └── APPServices.ps1 │ └── PublicFunctions │ ├── Diagram │ ├── Build-ARIDiagramSubnet.ps1 │ ├── Set-ARIDiagramFile.ps1 │ ├── Start-ARIDiagramJob.ps1 │ ├── Start-ARIDiagramNetwork.ps1 │ ├── Start-ARIDiagramOrganization.ps1 │ ├── Start-ARIDiagramSubscription.ps1 │ └── Start-ARIDrawIODiagram.ps1 │ ├── Invoke-ARI.ps1 │ ├── Invoke-AzureRAMPInventory.ps1 │ └── Jobs │ ├── Start-ARIAdvisoryJob.ps1 │ ├── Start-ARIPolicyJob.ps1 │ ├── Start-ARISecCenterJob.ps1 │ ├── Start-ARISubscriptionJob.ps1 │ └── Wait-ARIJob.ps1 ├── README.md ├── SECURITY.md ├── SUPPORT.md ├── azure-pipelines └── ari-inventory.yml ├── docs ├── README.md ├── about │ ├── authors.md │ ├── changelog.md │ └── license.md ├── advanced │ ├── automation.md │ ├── azure-devops.md │ ├── github-actions.md │ ├── local-testing.md │ └── resource-types.md ├── development │ ├── contributing.md │ └── module-structure.md ├── features │ ├── azure-advisor.md │ ├── excel-reports.md │ ├── network-diagrams.md │ └── security-center.md ├── getting-started │ ├── installation.md │ └── quick-start.md ├── images │ ├── ARIAUT_Identity.png │ ├── ARIAUT_NewRunTime.png │ ├── ARIAUT_Runbook.png │ ├── ARIAUT_Runbookcmd.png │ ├── ARIAUT_Runtime.png │ ├── ARIAUT_RuntimePackages.png │ ├── ARIFiles.png │ ├── ARI_Logo.png │ ├── ARIv35-Overview.png │ ├── ARIv3DrawioHover.png │ ├── ARIv3DrawioPeer.png │ ├── ARIv3ExcelExample.png │ ├── AUTv4Runbook.png │ ├── AUTv4STGPerm.png │ ├── AUTv4Tenant.png │ ├── Automation.png │ ├── DefaultARI.png │ ├── Download.png │ ├── DrawioImage.png │ ├── DrawioImport.png │ ├── DrawioOrganization.png │ ├── Extract.png │ ├── ImportingARI.gif │ ├── InstallARI.gif │ ├── RunningARI.gif │ ├── TenantsMenu.png │ ├── Unblock.png │ ├── cloudshell-warning-lib.png │ ├── drawioopen.png │ ├── drawiosubs.png │ ├── multitenant.png │ └── tenantID.png ├── index.md └── user-guide │ ├── basic-usage.md │ ├── common-scenarios.md │ ├── faq.md │ ├── parameters.md │ └── troubleshooting.md ├── images ├── ARIFiles.png ├── ARI_Logo.png ├── ARIv35-Overview.png ├── ARIv3DrawioHover.png ├── ARIv3DrawioPeer.png ├── ARIv3ExcelExample.png ├── Automation.png ├── DefaultARI.png ├── Download.png ├── DrawioImage.png ├── DrawioImport.png ├── DrawioOrganization.png ├── Extract.png ├── ImportingARI.gif ├── InstallARI.gif ├── RunningARI.gif ├── TenantsMenu.png ├── Unblock.png ├── cloudshell-warning-lib.png ├── drawioopen.png ├── drawiosubs.png ├── multitenant.png └── tenantID.png ├── mkdocs.yml ├── requirements.txt ├── test-azure-inventory-workflow.sh ├── test-azure-inventory.sh ├── test-docs-workflow.sh ├── test-docs.sh ├── test-workflow.sh └── workflow_dispatch.json /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[Bug]:" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | How can we reproduce this error? What were your input parameters? 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Screenshots** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Environment** 23 | On what kind of system were you running? When have you installed ARI? 24 | 25 | **Azure cloud special setting** 26 | Is the Environment specially configured(Government cloud, MFA login, etc.) 27 | 28 | **Additional context** 29 | Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[Request]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question-.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 'Question ' 3 | about: Have a question about the project? 4 | title: "[Question]:" 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Have a question about the project? Please write it down under!** 11 | 12 | You can format your question using Markdown styling, so it's easier to understand! 13 | 14 | **What version are you using?** 15 | The version you would be using or the version your question is about 16 | 17 | **Any other context information** 18 | Any additional information that might be helpful to answear your question 19 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | # Documentation Update 2 | 3 | ## Description 4 | 5 | This PR adds a comprehensive documentation system using MkDocs with the Material theme. 6 | 7 | ## Changes Made 8 | 9 | - Added MkDocs with Material theme configuration 10 | - Created documentation structure with the following sections: 11 | - Getting Started (Installation and Quick Start) 12 | - User Guide (Basic Usage, Parameters, Common Scenarios) 13 | - Features (Excel Reports and more) 14 | - Advanced (Automation and Resource Types) 15 | - Added GitHub Actions workflow for automatic documentation deployment 16 | - Added local testing scripts (`test-docs.sh` and `test-workflow.sh`) 17 | 18 | ## Testing 19 | 20 | - Documentation has been tested locally with `mkdocs serve` 21 | - GitHub workflow has been tested locally with `act` 22 | 23 | ## Deployment Instructions 24 | 25 | 1. Review the documentation content for accuracy and completeness 26 | 2. Make any required adjustments to the content or structure 27 | 3. Once merged, the GitHub workflow will deploy the documentation to GitHub Pages 28 | 4. Enable GitHub Pages in repository settings: 29 | - Go to Settings > Pages 30 | - Select "GitHub Actions" as the source 31 | - The documentation will be available at `https://[organization].github.io/ARI/` 32 | 33 | ## Screenshots 34 | 35 | (If applicable, add screenshots of the documentation site) 36 | 37 | ## Checklist 38 | 39 | - [ ] Documentation content is accurate and up-to-date 40 | - [ ] All links work correctly 41 | - [ ] Documentation navigation is intuitive 42 | - [ ] GitHub workflow is correctly configured 43 | - [ ] MkDocs configuration is correctly set up 44 | - [ ] Documentation renders correctly in local testing -------------------------------------------------------------------------------- /.github/workflows/azure-inventory.yml: -------------------------------------------------------------------------------- 1 | name: Azure Resource Inventory 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | subscriptionId: 7 | description: 'Specific subscription ID (optional)' 8 | required: false 9 | default: '00000000-0000-0000-0000-000000000000' 10 | resourceGroup: 11 | description: 'Specific resource group (optional)' 12 | required: false 13 | default: 'test-rg' 14 | reportName: 15 | description: 'Custom report name (optional)' 16 | required: false 17 | default: 'TestInventory' 18 | 19 | jobs: 20 | run-inventory: 21 | runs-on: ubuntu-latest 22 | steps: 23 | - name: Checkout repository 24 | uses: actions/checkout@v3 25 | 26 | # For local testing, we'll simulate the Azure login step 27 | - name: Simulate Azure Login 28 | run: | 29 | echo "Azure login simulated for local testing" 30 | 31 | # For local testing with act, we'll simulate the module installation and ARI execution 32 | - name: Simulate ARI Installation and Run 33 | shell: bash 34 | run: | 35 | echo "Installing ARI modules (simulation for testing)" 36 | echo "Running Invoke-ARI with parameters:" 37 | echo "- ReportName: ${{ github.event.inputs.reportName }}" 38 | echo "- SubscriptionID: ${{ github.event.inputs.subscriptionId }}" 39 | echo "- ResourceGroup: ${{ github.event.inputs.resourceGroup }}" 40 | 41 | # Create dummy report files 42 | mkdir -p ari-reports 43 | echo "This is a test Excel report" > ari-reports/test_report.xlsx 44 | echo "This is a test diagram file" > ari-reports/test_diagram.drawio 45 | 46 | # List the created files 47 | echo "Created files:" 48 | ls -la ari-reports/ 49 | 50 | echo "Workflow execution completed successfully" 51 | 52 | # Optional: Upload to Azure Storage 53 | # - name: Upload to Azure Storage 54 | # shell: pwsh 55 | # run: | 56 | # $storageAccount = "yourstorageaccount" 57 | # $container = "ari-reports" 58 | # 59 | # # Create the storage context 60 | # $ctx = New-AzStorageContext -StorageAccountName $storageAccount -UseConnectedAccount 61 | # 62 | # # Upload files to Azure Storage 63 | # Get-ChildItem -Path "$env:GITHUB_WORKSPACE/ari-reports" -File | ForEach-Object { 64 | # Set-AzStorageBlobContent -File $_.FullName -Container $container -Blob $_.Name -Context $ctx -Force 65 | # } 66 | 67 | # Optional: Send email notification 68 | # - name: Send Email Notification 69 | # uses: dawidd6/action-send-mail@v3 70 | # with: 71 | # server_address: smtp.gmail.com 72 | # server_port: 465 73 | # username: ${{ secrets.EMAIL_USERNAME }} 74 | # password: ${{ secrets.EMAIL_PASSWORD }} 75 | # subject: Azure Resource Inventory Report 76 | # body: Azure Resource Inventory has completed. Reports are attached. 77 | # to: recipient@example.com 78 | # from: Azure Inventory -------------------------------------------------------------------------------- /.github/workflows/documentation.yml: -------------------------------------------------------------------------------- 1 | name: Build and Deploy Documentation 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | - 'docs/**' 9 | - 'mkdocs.yml' 10 | - '.github/workflows/documentation.yml' 11 | pull_request: 12 | branches: 13 | - main 14 | paths: 15 | - 'docs/**' 16 | - 'mkdocs.yml' 17 | - '.github/workflows/documentation.yml' 18 | workflow_dispatch: 19 | 20 | jobs: 21 | build-and-deploy: 22 | runs-on: ubuntu-latest 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v3 26 | with: 27 | fetch-depth: 0 28 | 29 | - name: Setup Python 30 | uses: actions/setup-python@v4 31 | with: 32 | python-version: '3.x' 33 | 34 | - name: Install dependencies 35 | run: | 36 | python -m pip install --upgrade pip 37 | pip install -r requirements.txt 38 | 39 | - name: Build MkDocs site 40 | run: mkdocs build 41 | 42 | - name: Deploy (if on main branch) 43 | if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' 44 | uses: peaceiris/actions-gh-pages@v3 45 | with: 46 | github_token: ${{ secrets.GITHUB_TOKEN }} 47 | publish_dir: ./site -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. 2 | # 3 | # You can adjust the behavior by modifying this file. 4 | # For more information, see: 5 | # https://github.com/actions/stale 6 | name: Mark stale issues and pull requests 7 | 8 | on: 9 | schedule: 10 | - cron: '42 14 * * *' 11 | 12 | jobs: 13 | stale: 14 | 15 | runs-on: ubuntu-latest 16 | permissions: 17 | issues: write 18 | pull-requests: write 19 | 20 | steps: 21 | - uses: actions/stale@v5 22 | with: 23 | repo-token: ${{ secrets.GITHUB_TOKEN }} 24 | stale-issue-message: 'This Issue is stale and may be automatically close soon.' 25 | stale-pr-message: 'This PR is stale and may be automatically close soon.' 26 | stale-issue-label: 'no-issue-activity' 27 | stale-pr-label: 'no-pr-activity' 28 | days-before-stale: 30 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # PowerShell module specific 2 | *.psd1.backup 3 | *.psm1.backup 4 | *.ps1.backup 5 | *.ps1.bak 6 | *.psm1.bak 7 | *.psd1.bak 8 | 9 | # PowerShell module output 10 | output/ 11 | out/ 12 | 13 | # PowerShell Studio files 14 | *.psprojs 15 | *.psproj 16 | *.TempPoint.* 17 | 18 | # PowerShell Gallery package 19 | *.nupkg 20 | 21 | # PowerShell test results 22 | TestResults/ 23 | TestResults.xml 24 | 25 | # Pester test results 26 | coverage.xml 27 | coverage/ 28 | 29 | # PSScriptAnalyzer results 30 | PSScriptAnalyzer.results.xml 31 | 32 | # MkDocs specific 33 | site/ 34 | docs_build/ 35 | __pycache__/ 36 | *.py[cod] 37 | *$py.class 38 | *.so 39 | .Python 40 | env/ 41 | build/ 42 | develop-eggs/ 43 | dist/ 44 | downloads/ 45 | eggs/ 46 | .eggs/ 47 | lib/ 48 | lib64/ 49 | parts/ 50 | sdist/ 51 | var/ 52 | *.egg-info/ 53 | .installed.cfg 54 | *.egg 55 | 56 | # Python virtual environment 57 | venv/ 58 | ENV/ 59 | docs-venv/ 60 | .venv/ 61 | 62 | # IDE specific files 63 | .idea/ 64 | .vscode/ 65 | *.swp 66 | *.swo 67 | *~ 68 | .DS_Store 69 | Thumbs.db 70 | 71 | # Logs 72 | logs/ 73 | *.log 74 | npm-debug.log* 75 | yarn-debug.log* 76 | yarn-error.log* 77 | 78 | # Runtime data 79 | pids 80 | *.pid 81 | *.seed 82 | *.pid.lock 83 | 84 | # Temporary files 85 | tmp/ 86 | temp/ 87 | .tmp/ 88 | .temp/ 89 | 90 | # Excel temporary files 91 | ~$*.xlsx 92 | ~$*.xls 93 | ~$*.xlsm 94 | ~$*.xlsb 95 | 96 | # Drawio temporary files 97 | .$*.drawio.bkp 98 | .$*.drawio.dtmp 99 | 100 | # Azure Resource Inventory specific 101 | ari-reports/ 102 | *.xlsx 103 | *.drawio 104 | !docs/images/*.xlsx 105 | !docs/images/*.drawio 106 | 107 | # Local test files 108 | local-test/ 109 | test-results/ 110 | 111 | # Azure credentials and secrets 112 | *.publishsettings 113 | *.pfx 114 | *.p12 115 | *.pem 116 | *.key 117 | *.crt 118 | *.cer 119 | *.azureauth 120 | azureauth.json 121 | *.azurecredentials 122 | *credentials*.json 123 | *secrets*.json 124 | *connection*.json 125 | 126 | # Azure CLI and PowerShell Azure Module cache 127 | .azure/ 128 | .azcli/ 129 | 130 | # Terraform files 131 | .terraform/ 132 | *.tfstate 133 | *.tfstate.backup 134 | *.tfvars 135 | 136 | # Bicep files 137 | *.bicepparam 138 | 139 | # Act (GitHub Actions local testing) 140 | .actrc 141 | .secrets 142 | 143 | # Docker 144 | .docker/ 145 | Docker.*.env 146 | 147 | # Node.js (for potential web components) 148 | node_modules/ 149 | 150 | # Jupyter Notebooks (for potential data analysis) 151 | .ipynb_checkpoints/ 152 | *.ipynb 153 | 154 | # R files (for potential data analysis) 155 | .Rproj.user/ 156 | .Rhistory 157 | .RData 158 | .Ruserdata 159 | 160 | # macOS extended attributes 161 | ._* 162 | 163 | # Windows shortcuts 164 | *.lnk 165 | 166 | # Windows thumbnail cache 167 | ehthumbs.db 168 | ehthumbs_vista.db 169 | 170 | # Windows folder config 171 | Desktop.ini 172 | 173 | # Windows Recycle Bin used on file shares 174 | $RECYCLE.BIN/ 175 | 176 | # Windows Installer files 177 | *.cab 178 | *.msi 179 | *.msm 180 | *.msp 181 | 182 | # Backup files created by various editors 183 | *.bak 184 | *.gho 185 | *.ori 186 | *.orig 187 | *.tmp 188 | 189 | # Archive files 190 | *.7z 191 | *.jar 192 | *.rar 193 | *.zip 194 | *.gz 195 | *.tgz 196 | *.bzip 197 | *.bz2 198 | *.xz 199 | *.lzma 200 | *.cab 201 | *.iso 202 | *.tar 203 | 204 | # Compiled source 205 | *.com 206 | *.class 207 | *.dll 208 | *.exe 209 | *.o 210 | *.obj 211 | 212 | # Dependency directories 213 | vendor/ 214 | -------------------------------------------------------------------------------- /AzureResourceInventory.psm1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Azure Resource Inventory - A powerful tool to create an Excel inventory from Azure resources with minimal effort. 4 | 5 | .DESCRIPTION 6 | This module orchestrates the process of dot sourcing the modules (and functions) that will be triggered by the Invoke-ARI cmdlet. 7 | 8 | .AUTHOR 9 | Claudio Merola 10 | 11 | .COMPANYNAME 12 | Claudio Merola 13 | 14 | .COPYRIGHT 15 | (c) Claudio Merola. All rights reserved. 16 | 17 | .VERSION 18 | 3.6.2 19 | 20 | #> 21 | 22 | foreach ($directory in @('modules\Private', '.\modules\Public\PublicFunctions')) { 23 | Get-ChildItem -Path "$PSScriptRoot\$directory\*.ps1" -Recurse | ForEach-Object { . $_.FullName } 24 | } 25 | 26 | 27 | <# 28 | $PrivateFiles = @( Get-ChildItem -Path (Join-Path $PSScriptRoot "Modules" "Private" "*.ps1") -Recurse -ErrorAction SilentlyContinue ) 29 | $PublicFiles = @( Get-ChildItem -Path (Join-Path $PSScriptRoot "Modules" "Public" "PublicFunctions" "*.ps1") -Recurse -ErrorAction SilentlyContinue ) 30 | 31 | Foreach($import in @($PrivateFiles + $PublicFiles)) 32 | { 33 | Try 34 | { 35 | . $import.fullname 36 | } 37 | Catch 38 | { 39 | Write-Error -Message "Failed to import function $($import.fullname): $_" 40 | } 41 | } 42 | 43 | Export-ModuleMember -Function $PublicFiles.Basename 44 | 45 | #> -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 RenatoGregio 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Clear-ARICacheFolder.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Clear cache folder for Azure Resource Inventory 4 | 5 | .DESCRIPTION 6 | This module clears the cache folder for Azure Resource Inventory. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Clear-ARICacheFolder.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | 21 | function Clear-ARICacheFolder { 22 | Param($ReportCache) 23 | 24 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Clearing Cache Folder.') 25 | $CacheFiles = Get-ChildItem -Path $ReportCache -Recurse 26 | Foreach ($CacheFile in $CacheFiles) 27 | { 28 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Removing Cache File: '+$CacheFile.FullName) 29 | Remove-Item -Path $CacheFile.FullName -Force 30 | } 31 | } -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Clear-ARIMemory.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Clear memory for Azure Resource Inventory 4 | 5 | .DESCRIPTION 6 | This module clears memory to optimize performance for Azure Resource Inventory. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Clear-ARIMemory.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Clear-ARIMemory { 21 | 22 | [System.GC]::GetTotalMemory($true) | Out-Null 23 | Start-Sleep -Milliseconds 100 24 | [System.GC]::Collect() | Out-Null 25 | Start-Sleep -Milliseconds 100 26 | } -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Get-ARIUnsupportedData.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Retrieve unsupported data for Azure Resource Inventory 4 | 5 | .DESCRIPTION 6 | This module retrieves unsupported data from a predefined JSON file for Azure Resource Inventory. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Get-ARIUnsupportedData.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Get-ARIUnsupportedData { 21 | 22 | $SupportedDataPath = (get-item $PSScriptRoot).parent 23 | $SupportFile = Join-Path $SupportedDataPath '3.ReportingFunctions' 'StyleFunctions' 'Support.json' 24 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Validating file: '+$SupportFile) 25 | 26 | $Unsupported = Get-Content -Path $SupportFile | ConvertFrom-Json 27 | 28 | return $Unsupported 29 | } -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Remove-ARIExcelProcess.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Forcefully stops Excel process. 4 | 5 | .DESCRIPTION 6 | This module forcefully stops the Excel process. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Remove-ARIExcelProcess.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | 21 | function Remove-ARIExcelProcess { 22 | 23 | if (Get-Process -Name "excel" -ErrorAction Ignore | Where-Object { $_.CommandLine -like '*/automation*' } ) 24 | { 25 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss') + ' - Stopping Excel process.') 26 | Get-Process -Name "excel" -ErrorAction Ignore | Where-Object { $_.CommandLine -like '*/automation*' } | Stop-Process -Force 27 | } 28 | } -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Set-ARIFolder.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Set up folders for Azure Resource Inventory 4 | 5 | .DESCRIPTION 6 | This module creates and validates the necessary folders for Azure Resource Inventory. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Set-ARIFolder.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Set-ARIFolder { 21 | Param($DefaultPath, $DiagramCache, $ReportCache) 22 | 23 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Checking report folder: ' + $DefaultPath ) 24 | try { 25 | if ((Test-Path -Path $DefaultPath -PathType Container) -eq $false) { 26 | New-Item -Type Directory -Force -Path $DefaultPath | Out-Null 27 | } 28 | if ((Test-Path -Path $DiagramCache -PathType Container) -eq $false) { 29 | New-Item -Type Directory -Force -Path $DiagramCache | Out-Null 30 | } 31 | if ((Test-Path -Path $ReportCache -PathType Container) -eq $false) { 32 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Creating Folder for Cache Files.') 33 | New-Item -Type Directory -Force -Path $ReportCache | Out-Null 34 | } 35 | } 36 | catch 37 | { 38 | Write-Output ($_.Exception.Message) 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Set-ARIReportPath.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Set the report path for Azure Resource Inventory 4 | 5 | .DESCRIPTION 6 | This module sets the default paths for report generation in Azure Resource Inventory. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Set-ARIReportPath.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Set-ARIReportPath { 21 | Param($ReportDir) 22 | 23 | if ($ReportDir) 24 | { 25 | $DefaultPath = $ReportDir 26 | $DiagramCache = Join-Path $ReportDir "DiagramCache" 27 | $ReportCache = Join-Path $ReportDir 'ReportCache' 28 | } 29 | elseif (Resolve-Path -Path 'C:\' -ErrorAction SilentlyContinue) 30 | { 31 | $DefaultPath = Join-Path "C:\" "AzureResourceInventory" 32 | $DiagramCache = Join-Path "C:\" "AzureResourceInventory" "DiagramCache" 33 | $ReportCache = Join-Path "C:\" "AzureResourceInventory"'ReportCache' 34 | } 35 | else 36 | { 37 | $DefaultPath = Join-Path "$HOME" "AzureResourceInventory" 38 | $DiagramCache = Join-Path "$HOME" "AzureResourceInventory" "DiagramCache" 39 | $ReportCache = Join-Path "$HOME" "AzureResourceInventory" 'ReportCache' 40 | } 41 | 42 | $ReportPath = @{ 43 | 'DefaultPath' = $DefaultPath; 44 | 'DiagramCache' = $DiagramCache; 45 | 'ReportCache' = $ReportCache 46 | } 47 | 48 | return $ReportPath 49 | } -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Start-ARIExtractionOrchestration.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Extraction orchestration for Azure Resource Inventory 4 | 5 | .DESCRIPTION 6 | This module orchestrates the extraction of resources for Azure Resource Inventory. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Start-ARIExtractionOrchestration.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Start-ARIExtractionOrchestration { 21 | Param($ManagementGroup, $Subscriptions, $SubscriptionID, $SkipPolicy, $ResourceGroup, $SecurityCenter, $SkipAdvisory, $IncludeTags, $TagKey, $TagValue, $SkipAPIs, $SkipVMDetails, $IncludeCosts, $Automation) 22 | 23 | $GraphData = Start-ARIGraphExtraction -ManagementGroup $ManagementGroup -Subscriptions $Subscriptions -SubscriptionID $SubscriptionID -ResourceGroup $ResourceGroup -SecurityCenter $SecurityCenter -SkipAdvisory $SkipAdvisory -IncludeTags $IncludeTags -TagKey $TagKey -TagValue $TagValue 24 | 25 | $Resources = $GraphData.Resources 26 | $ResourceContainers = $GraphData.ResourceContainers 27 | $Advisories = $GraphData.Advisories 28 | $Security = $GraphData.Security 29 | $Retirements = $GraphData.Retirements 30 | 31 | Remove-Variable -Name GraphData -ErrorAction SilentlyContinue 32 | 33 | $ResourcesCount = [string]$Resources.Count 34 | $AdvisoryCount = [string]$Advisories.Count 35 | $SecCenterCount = [string]$Security.Count 36 | 37 | if(!$SkipAPIs.IsPresent) 38 | { 39 | Write-Progress -activity 'Azure Inventory' -Status "12% Complete." -PercentComplete 12 -CurrentOperation "Starting API Extraction.." 40 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Getting API Resources.') 41 | $APIResults = Get-ARIAPIResources -Subscriptions $Subscriptions -AzureEnvironment $AzureEnvironment -SkipPolicy $SkipPolicy 42 | $Resources += $APIResults.ResourceHealth 43 | $Resources += $APIResults.ManagedIdentities 44 | $Resources += $APIResults.AdvisorScore 45 | $Resources += $APIResults.ReservationRecomen 46 | $PolicyAssign = $APIResults.PolicyAssign 47 | $PolicyDef = $APIResults.PolicyDef 48 | $PolicySetDef = $APIResults.PolicySetDef 49 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'API Resource Inventory Finished.') 50 | Remove-Variable APIResults -ErrorAction SilentlyContinue 51 | } 52 | 53 | $PolicyCount = [string]$PolicyAssign.policyAssignments.Count 54 | 55 | if ($IncludeCosts.IsPresent) { 56 | $Costs = Get-ARICostInventory -Subscriptions $Subscriptions -Days 60 -Granularity 'Monthly' 57 | } 58 | 59 | if (!$SkipVMDetails.IsPresent) 60 | { 61 | Write-Host 'Gathering VM Extra Details: ' -NoNewline 62 | Write-Host 'Quotas' -ForegroundColor Cyan 63 | Write-Progress -activity 'Azure Inventory' -Status "13% Complete." -PercentComplete 13 -CurrentOperation "Starting VM Details Extraction.." 64 | 65 | $VMQuotas = Get-AriVMQuotas -Subscriptions $Subscriptions -Resources $Resources 66 | 67 | $Resources += $VMQuotas 68 | 69 | Remove-Variable -Name VMQuotas -ErrorAction SilentlyContinue 70 | 71 | Write-Host 'Gathering VM Extra Details: ' -NoNewline 72 | Write-Host 'Size SKU' -ForegroundColor Cyan 73 | 74 | $VMSkuDetails = Get-ARIVMSkuDetails -Resources $Resources 75 | 76 | $Resources += $VMSkuDetails 77 | 78 | Remove-Variable -Name VMSkuDetails -ErrorAction SilentlyContinue 79 | 80 | } 81 | 82 | $ReturnData = [PSCustomObject]@{ 83 | Resources = $Resources 84 | Quotas = $VMQuotas 85 | Costs = $Costs 86 | ResourceContainers = $ResourceContainers 87 | Advisories = $Advisories 88 | ResourcesCount = $ResourcesCount 89 | AdvisoryCount = $AdvisoryCount 90 | SecCenterCount = $SecCenterCount 91 | Security = $Security 92 | Retirements = $Retirements 93 | PolicyCount = $PolicyCount 94 | PolicyAssign = $PolicyAssign 95 | PolicyDef = $PolicyDef 96 | PolicySetDef = $PolicySetDef 97 | } 98 | 99 | return $ReturnData 100 | } -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Start-ARIProcessOrchestration.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Process orchestration for Azure Resource Inventory 4 | 5 | .DESCRIPTION 6 | This module orchestrates the processing of resources for Azure Resource Inventory. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Start-ARIProcessOrchestration.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | 21 | function Start-ARIProcessOrchestration { 22 | Param($Subscriptions, $Resources, $Retirements, $DefaultPath, $File, $Heavy, $InTag, $Automation) 23 | 24 | Write-Progress -activity 'Azure Inventory' -Status "21% Complete." -PercentComplete 21 -CurrentOperation "Starting to process extracted data.." 25 | 26 | <######################################################### IMPORT UNSUPPORTED VERSION LIST ######################################################################> 27 | 28 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Importing List of Unsupported Versions.') 29 | 30 | $Unsupported = Get-ARIUnsupportedData 31 | 32 | <######################################################### RESOURCE GROUP JOB ######################################################################> 33 | 34 | if ($Automation.IsPresent) 35 | { 36 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Processing Resources in Automation Mode') 37 | 38 | Start-ARIAutProcessJob -Resources $Resources -Retirements $Retirements -Subscriptions $Subscriptions -InTag $InTag -Unsupported $Unsupported 39 | } 40 | else 41 | { 42 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Processing Resources in Regular Mode') 43 | 44 | Start-ARIProcessJob -Resources $Resources -Retirements $Retirements -Subscriptions $Subscriptions -DefaultPath $DefaultPath -InTag $InTag -Heavy $Heavy -Unsupported $Unsupported 45 | } 46 | 47 | Remove-Variable -Name Unsupported -ErrorAction SilentlyContinue 48 | 49 | <############################################################## RESOURCES PROCESSING #############################################################> 50 | 51 | if(![string]::IsNullOrEmpty($JobNames)) 52 | { 53 | if ($Automation.IsPresent) 54 | { 55 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Waiting for Resource Jobs to Complete in Automation Mode') 56 | Get-Job | Where-Object {$_.name -like 'ResourceJob_*'} | Wait-Job 57 | } 58 | else 59 | { 60 | $JobNames = (Get-Job | Where-Object {$_.name -like 'ResourceJob_*'}).Name 61 | Wait-ARIJob -JobNames $JobNames -JobType 'Resource' -LoopTime 5 62 | } 63 | 64 | if ($Automation.IsPresent) 65 | { 66 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Processing Resources in Automation Mode') 67 | } 68 | else 69 | { 70 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Finished Waiting for Resource Jobs.') 71 | } 72 | 73 | Build-ARICacheFiles -DefaultPath $DefaultPath -JobNames $JobNames 74 | } 75 | 76 | Write-Progress -activity 'Azure Inventory' -Status "60% Complete." -PercentComplete 60 -CurrentOperation "Completed Data Processing Phase.." 77 | 78 | } -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Start-ARIReporOrchestration.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Main module for Excel Report Building 4 | 5 | .DESCRIPTION 6 | This module is the main module for building the Excel Report. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Start-ARIReporOrchestration.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | Function Start-ARIReporOrchestration { 21 | Param($ReportCache, 22 | $SecurityCenter, 23 | $File, 24 | $Quotas, 25 | $SkipPolicy, 26 | $SkipAdvisory, 27 | $Automation, 28 | $TableStyle, 29 | $IncludeCosts) 30 | 31 | Write-Progress -activity 'Azure Inventory' -Status "65% Complete." -PercentComplete 65 -CurrentOperation "Starting the Report Phase.." 32 | 33 | <############################################################## REPORT CREATION ###################################################################> 34 | 35 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Resource Reporting Cache.') 36 | Start-ARIExcelJob -ReportCache $ReportCache -TableStyle $TableStyle -File $File 37 | 38 | <############################################################## REPORT EXTRA DETAILS ###################################################################> 39 | 40 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Reporting Extra Details.') 41 | Start-ARIExcelExtraData -File $File 42 | 43 | <############################################################## EXTRA REPORTS ###################################################################> 44 | 45 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Default Data Reporting.') 46 | 47 | Start-ARIExtraReports -File $File -Quotas $Quotas -SecurityCenter $SecurityCenter -SkipPolicy $SkipPolicy -SkipAdvisory $SkipAdvisory -IncludeCosts $IncludeCosts -TableStyle $TableStyle 48 | 49 | } -------------------------------------------------------------------------------- /Modules/Private/0.MainFunctions/Test-ARIPS.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Test Powershell environment 4 | 5 | .DESCRIPTION 6 | This module is used to test and validate the Powershell environment. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Test-ARIPS.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Test-ARIPS { 21 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Test-ARIPS function') 22 | $CShell = try{Get-CloudShellTip}catch{$null} 23 | if ($CShell) { 24 | Write-Host 'Azure CloudShell Identified.' -ForegroundColor Cyan 25 | $PlatOS = 'Azure CloudShell' 26 | } 27 | else 28 | { 29 | if ($PSVersionTable.Platform -eq 'Unix') { 30 | Write-Host "PowerShell Unix Identified." -ForegroundColor Cyan 31 | $PlatOS = 'PowerShell Unix' 32 | 33 | } 34 | else { 35 | Write-Host "PowerShell Desktop Identified." -ForegroundColor Cyan 36 | $PlatOS = 'PowerShell Desktop' 37 | 38 | } 39 | } 40 | return $PlatOS 41 | } -------------------------------------------------------------------------------- /Modules/Private/1.ExtractionFunctions/Get-ARICostInventory.ps1: -------------------------------------------------------------------------------- 1 | function Get-ARICostInventory { 2 | Param($Subscriptions, $Days, $Granularity) 3 | 4 | #$Days = 60 5 | #$Granularity = 'Monthly' 6 | $Today = Get-Date 7 | $EndDate = Get-Date -Year $Today.Year -Month $Today.Month -Day $Today.Day -Hour 23 -Minute 59 -Second 59 -Millisecond 0 8 | 9 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss') + ' - ' + 'Starting Cost Inventory Extraction') 10 | 11 | $Grouping = @() 12 | $GTemp = @{Name='ResourceType';Type='Dimension'} 13 | $Grouping += $GTemp 14 | $GTemp = @{Name='ResourceGroup';Type='Dimension'} 15 | $Grouping += $GTemp 16 | $GTemp = @{Name='ResourceLocation';Type='Dimension'} 17 | $Grouping += $GTemp 18 | $GTemp = @{Name='ServiceName';Type='Dimension'} 19 | $Grouping += $GTemp 20 | 21 | 22 | $Hash = @{name="PreTaxCost";function="Sum"} 23 | $MHash = @{totalCost=$Hash} 24 | 25 | if ($Days -ge 365) 26 | { 27 | $StartDate = Get-date -Year $EndDate.AddYears(-1).Year -Month 1 -Day 1 -Hour 0 -Minute 0 -Second 0 -Millisecond 1 28 | $EndDate = Get-Date -Year $StartDate.Year -Month 12 -Day 31 -Hour 23 -Minute 59 -Second 59 -Millisecond 0 29 | } 30 | else 31 | { 32 | #$StartDate = ($EndDate).AddDays(-$Days) 33 | $StartDate = (Get-Date -Day 1).AddMonths(-2) 34 | } 35 | 36 | $Result = Foreach ($Subscription in $Subscriptions) 37 | { 38 | $SubId = $Subscription.id 39 | $SubName = $Subscription.name 40 | $Scope = ('/subscriptions/'+$SubId+'/') 41 | try 42 | { 43 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss') + ' - ' + 'Extracting Cost Data for: ' + $SubName) 44 | $Costs = Invoke-AzCostManagementQuery -Type ActualCost -Scope $Scope -Timeframe Custom -DatasetGranularity $Granularity -DatasetGrouping $Grouping -DatasetAggregation $MHash -TimePeriodFrom $StartDate -TimePeriodTo $EndDate -Debug:$false 45 | } 46 | catch 47 | { 48 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss') + ' - ' + 'Error Extracting Cost Data for Subscription: ' + $SubName) 49 | throw $_.Exception.Message 50 | $Costs = @() 51 | } 52 | 53 | $obj = @{ 54 | SubscriptionId = $SubId 55 | SubscriptionName = $SubName 56 | CostData = $Costs 57 | } 58 | Start-Sleep -Milliseconds 100 59 | $obj 60 | } 61 | 62 | return $Result 63 | 64 | } -------------------------------------------------------------------------------- /Modules/Private/1.ExtractionFunctions/Get-ARIManagementGroups.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for retrieving Azure Management Groups. 4 | 5 | .DESCRIPTION 6 | This module retrieves Azure Management Groups and their associated subscriptions. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/1.ExtractionFunctions/Get-ARIManagementGroups.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | function Get-ARIManagementGroups { 20 | Param ($ManagementGroup) 21 | 22 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Management group name supplied: ' + $ManagmentGroupName) 23 | $ReportCounter = 1 24 | $LocalResults = @() 25 | 26 | $group = Get-AzManagementGroupEntity 27 | $group = $group | Where-Object { $_.DisplayName -eq $ManagementGroup } 28 | if ($group.Count -lt 1) 29 | { 30 | Write-Host "ERROR:" -NoNewline -ForegroundColor Red 31 | Write-Host "Management Group $ManagementGroup not found!" 32 | Write-Host "" 33 | Write-Host "Please check the Management Group name and try again." 34 | Write-Host "" 35 | Exit 36 | } 37 | else 38 | { 39 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Management groups found: ' + $group.count) 40 | foreach ($item in $group) 41 | { 42 | $GraphQuery = "resourcecontainers | where type == 'microsoft.resources/subscriptions' | mv-expand managementGroupParent = properties.managementGroupAncestorsChain | where managementGroupParent.name =~ '$($item.DisplayName)'" 43 | $QueryResult = Search-AzGraph -Query $GraphQuery -first 1000 44 | $LocalResults += $QueryResult 45 | 46 | while ($QueryResult.SkipToken) { 47 | $ReportCounterVar = [string]$ReportCounter 48 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting Next 1000 Subscriptions. Loop Number: ' + $ReportCounterVar) 49 | $QueryResult = Search-AzGraph -Query $GraphQuery -SkipToken $QueryResult.SkipToken -Subscription $FSubscri -first 1000 50 | $LocalResults += $QueryResult 51 | $ReportCounter ++ 52 | } 53 | Write-Progress -Id 1 -activity "Running Subscription Inventory Job" -Status "$Looper / $Loop of Subscription Jobs" -Completed 54 | } 55 | } 56 | return $LocalResults 57 | } -------------------------------------------------------------------------------- /Modules/Private/1.ExtractionFunctions/Get-ARISubscriptions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for retrieving Azure subscriptions. 4 | 5 | .DESCRIPTION 6 | This module retrieves Azure subscriptions for a given tenant or specific subscription IDs. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/1.ExtractionFunctions/Get-ARISubscriptions.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | function Get-ARISubscriptions { 20 | Param ($TenantID,$SubscriptionID,$PlatOS) 21 | if($PlatOS -eq 'Azure CloudShell') 22 | { 23 | $Subscriptions = Get-AzSubscription -WarningAction SilentlyContinue -Debug:$false 24 | 25 | if ($SubscriptionID) 26 | { 27 | if($SubscriptionID.count -gt 1) 28 | { 29 | $Subscriptions = $Subscriptions | Where-Object { $_.ID -in $SubscriptionID } 30 | } 31 | else 32 | { 33 | $Subscriptions = $Subscriptions | Where-Object { $_.ID -eq $SubscriptionID } 34 | } 35 | } 36 | } 37 | else 38 | { 39 | Write-Host "Extracting Subscriptions from Tenant $TenantID" 40 | try 41 | { 42 | $Subscriptions = Get-AzSubscription -TenantId $TenantID -WarningAction SilentlyContinue -Debug:$false 43 | } 44 | catch 45 | { 46 | Write-Host ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+ " Error: $_") 47 | return 48 | } 49 | 50 | if ($SubscriptionID) 51 | { 52 | if($SubscriptionID.count -gt 1) 53 | { 54 | $Subscriptions = $Subscriptions | Where-Object { $_.ID -in $SubscriptionID } 55 | } 56 | else 57 | { 58 | $Subscriptions = $Subscriptions | Where-Object { $_.ID -eq $SubscriptionID } 59 | } 60 | } 61 | } 62 | 63 | return $Subscriptions 64 | } -------------------------------------------------------------------------------- /Modules/Private/1.ExtractionFunctions/ResourceDetails/Get-ARIVMQuotas.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for retrieving Azure VM quotas. 4 | 5 | .DESCRIPTION 6 | This module retrieves Azure VM quotas for specific subscriptions and locations. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/1.ExtractionFunctions/ResourceDetails/Get-ARIVMQuotas.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | function Get-AriVMQuotas { 20 | Param ($Subscriptions, $Resources) 21 | $Quotas = Foreach($Sub in $Subscriptions) 22 | { 23 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Getting VM Quota Details: '+$Sub.name) 24 | $Locs = ($Resources | Where-Object {$_.subscriptionId -eq $Sub.id -and $_.Type -in 'microsoft.compute/virtualmachines','microsoft.compute/virtualmachinescalesets'} | Group-Object -Property Location).name 25 | if (![string]::IsNullOrEmpty($Locs)) 26 | { 27 | Foreach($Loc in $Locs) 28 | { 29 | if($Loc.count -eq 1) 30 | { 31 | Set-AzContext -Subscription $Sub.Id -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Debug:$false 32 | $Quota = get-azvmusage -location $Loc -Debug:$false 33 | $Quota = $Quota | Where-Object {$_.CurrentValue -ge 1} 34 | $tmp = [PSCustomObject]@{ 35 | Location = $Loc 36 | SubId = $Sub.id 37 | Subscription = $Sub.name 38 | Data = $Quota 39 | } 40 | $tmp 41 | } 42 | else { 43 | Set-AzContext -Subscription $Sub.Id -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -InformationAction SilentlyContinue -Debug:$false 44 | foreach($Loc1 in $Loc) 45 | { 46 | $Quota = get-azvmusage -location $Loc1 -Debug:$false 47 | $Quota = $Quota | Where-Object {$_.CurrentValue -ge 1} 48 | $tmp = [PSCustomObject]@{ 49 | Location = $Loc1 50 | SubId = $Sub.id 51 | Subscription = $Sub.name 52 | Data = $Quota 53 | } 54 | $tmp 55 | } 56 | } 57 | } 58 | } 59 | } 60 | 61 | $VMQuotas = [PSCustomObject]@{ 62 | 'type' = 'ARI/VM/Quotas' 63 | 'properties' = $Quotas 64 | } 65 | 66 | return $VMQuotas 67 | } -------------------------------------------------------------------------------- /Modules/Private/1.ExtractionFunctions/ResourceDetails/Get-ARIVMSkuDetails.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for retrieving Azure VM SKU details. 4 | 5 | .DESCRIPTION 6 | This module retrieves details about Azure VM SKUs available in specific locations. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/1.ExtractionFunctions/ResourceDetails/Get-ARIVMSkuDetails.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola, Olli Uronen (Seppohto) 18 | #> 19 | function Get-ARIVMSkuDetails { 20 | Param ($Resources) 21 | 22 | $vm = $Resources | Where-Object {$_.TYPE -in 'microsoft.compute/virtualmachines','microsoft.compute/virtualmachinescalesets'} 23 | 24 | $VMskuData = Foreach($location in ($vm | Select-Object -ExpandProperty location -Unique)) 25 | { 26 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Getting VM SKU Details: '+$location) 27 | $tmp = [PSCustomObject]@{ 28 | Location = $location 29 | SKUs = Get-AzComputeResourceSku $location -Debug:$false 30 | } 31 | $tmp 32 | } 33 | 34 | $VMSkuDetails = [PSCustomObject]@{ 35 | 'type' = 'ARI/VM/SKU' 36 | 'properties' = $VMskuData 37 | } 38 | 39 | return $VMSkuDetails 40 | } -------------------------------------------------------------------------------- /Modules/Private/2.ProcessingFunctions/Build-ARICacheFiles.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for creating the local cache files for the report. 4 | 5 | .DESCRIPTION 6 | This module receives the job names for the Azure Resources that were processed previously and creates the local cache files that will be used to build the Excel report. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Build-ARICacheFiles.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Build-ARICacheFiles { 21 | Param($DefaultPath, $JobNames) 22 | 23 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Checking Cache Folder.') 24 | 25 | $Lops = $JobNames.count 26 | $Counter = 0 27 | 28 | Foreach ($Job in $JobNames) 29 | { 30 | $c = (($ReportCounter / $Lops) * 100) 31 | $c = [math]::Round($c) 32 | Write-Progress -Id 1 -activity "Building Cache Files" -Status "$c% Complete." -PercentComplete $c 33 | 34 | $NewJobName = ($Job -replace 'ResourceJob_','') 35 | $TempJob = Receive-Job -Name $Job 36 | if (![string]::IsNullOrEmpty($TempJob.values)) 37 | { 38 | $JobJSONName = ($NewJobName+'.json') 39 | $JobFileName = Join-Path $DefaultPath 'ReportCache' $JobJSONName 40 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Creating Cache File: '+ $JobFileName) 41 | $TempJob | ConvertTo-Json -Depth 40 | Out-File $JobFileName 42 | } 43 | Remove-Job -Name $Job 44 | Remove-Variable -Name TempJob 45 | 46 | $Counter++ 47 | 48 | } 49 | Clear-ARIMemory 50 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Cache Files Created.') 51 | } -------------------------------------------------------------------------------- /Modules/Private/2.ProcessingFunctions/Invoke-ARIAdvisoryJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for invoking advisory processing jobs. 4 | 5 | .DESCRIPTION 6 | This module starts jobs to process advisory data for Azure Resources, either in automation or manual mode. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Invoke-ARIAdvisoryJob.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.5 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Invoke-ARIAdvisoryJob { 21 | Param($Advisories, $ARIModule, $Automation) 22 | 23 | if ($Automation.IsPresent) 24 | { 25 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Advisory Job') 26 | Start-ThreadJob -Name 'Advisory' -ScriptBlock { 27 | 28 | import-module $($args[1]) 29 | 30 | $AdvResult = Start-ARIAdvisoryJob -Advisories $($args[0]) 31 | 32 | $AdvResult 33 | 34 | } -ArgumentList $Advisories, $ARIModule | Out-Null 35 | } 36 | else 37 | { 38 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Advisory Job.') 39 | Start-Job -Name 'Advisory' -ScriptBlock { 40 | 41 | import-module $($args[1]) 42 | 43 | $AdvResult = Start-ARIAdvisoryJob -Advisories $($args[0]) 44 | 45 | $AdvResult 46 | 47 | } -ArgumentList $Advisories, $ARIModule | Out-Null 48 | } 49 | } -------------------------------------------------------------------------------- /Modules/Private/2.ProcessingFunctions/Invoke-ARIDrawIOJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for invoking Draw.IO diagram generation jobs. 4 | 5 | .DESCRIPTION 6 | This module starts jobs to generate Draw.IO diagrams for Azure Resources, including resource relationships and advisory data. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Invoke-ARIDrawIOJob.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Invoke-ARIDrawIOJob { 21 | Param($Subscriptions, $Resources, $Advisories, $DDFile, $DiagramCache, $FullEnv, $ResourceContainers, $Automation, $ARIModule) 22 | 23 | if ($Automation.IsPresent) 24 | { 25 | Write-Output "Invoking Draw.Io main function." 26 | try 27 | { 28 | Start-ARIDrawIODiagram -Subscriptions $Subscriptions -Resources $Resources -Advisories $Advisories -DDFile $DDFile -DiagramCache $DiagramCache -FullEnvironment $FullEnv -ResourceContainers $ResourceContainers -Automation $Automation -ARIModule $ARIModule 29 | } 30 | catch 31 | { 32 | Write-Output ($_.Exception.Message) 33 | } 34 | } 35 | Else 36 | { 37 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Draw.IO Job.') 38 | Start-job -Name 'DrawDiagram' -ScriptBlock { 39 | 40 | import-module $($args[8]) 41 | 42 | $DiagramCache = $($args[4]) 43 | $TempPath = (get-item $DiagramCache).parent 44 | $LogFile = Join-Path $TempPath 'DiagramLogFile.log' 45 | 46 | ('DrawIOCoreJob - '+(get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - Starting Draw.IO Job') | Out-File -FilePath $LogFile -Append 47 | try 48 | { 49 | Start-ARIDrawIODiagram -Subscriptions $($args[0]) -Resources $($args[1]) -Advisories $($args[2]) -DDFile $($args[3]) -DiagramCache $($args[4]) -FullEnvironment $($args[5]) -ResourceContainers $($args[6]) -Automation $($args[7]) -ARIModule $($args[8]) 50 | } 51 | catch 52 | { 53 | ('DrawIOCoreJob - '+(get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+$_.Exception.Message) | Out-File -FilePath $LogFile -Append 54 | } 55 | ('DrawIOCoreJob - '+(get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - Draw.IO Ended.') | Out-File -FilePath $LogFile -Append 56 | 57 | } -ArgumentList $Subscriptions, $Resources, $Advisories, $DDFile, $DiagramCache, $FullEnv, $ResourceContainers, $Automation, $ARIModule | Out-Null 58 | } 59 | } -------------------------------------------------------------------------------- /Modules/Private/2.ProcessingFunctions/Invoke-ARIPolicyJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for invoking policy evaluation jobs. 4 | 5 | .DESCRIPTION 6 | This module starts jobs to evaluate Azure policies, including policy definitions, assignments, and set definitions, either in automation or manual mode. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Invoke-ARIPolicyJob.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.5 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Invoke-ARIPolicyJob { 21 | Param($Subscriptions, $PolicySetDef, $PolicyAssign, $PolicyDef, $ARIModule, $Automation) 22 | 23 | if ($Automation.IsPresent) 24 | { 25 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Policy Job') 26 | Start-ThreadJob -Name 'Policy' -ScriptBlock { 27 | 28 | import-module $($args[4]) 29 | 30 | $PolResult = Start-ARIPolicyJob -Subscriptions $($args[0]) -PolicySetDef $($args[1]) -PolicyAssign $($args[2]) -PolicyDef $($args[3]) 31 | 32 | $PolResult 33 | 34 | } -ArgumentList $Subscriptions, $PolicySetDef, $PolicyAssign, $PolicyDef, $ARIModule | Out-Null 35 | } 36 | else 37 | { 38 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Policy Job.') 39 | Start-Job -Name 'Policy' -ScriptBlock { 40 | 41 | import-module $($args[4]) 42 | 43 | $PolResult = Start-ARIPolicyJob -Subscriptions $($args[0]) -PolicySetDef $($args[1]) -PolicyAssign $($args[2]) -PolicyDef $($args[3]) 44 | 45 | $PolResult 46 | 47 | } -ArgumentList $Subscriptions, $PolicySetDef, $PolicyAssign, $PolicyDef, $ARIModule | Out-Null 48 | } 49 | } -------------------------------------------------------------------------------- /Modules/Private/2.ProcessingFunctions/Invoke-ARISecurityCenterJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for invoking Security Center processing jobs. 4 | 5 | .DESCRIPTION 6 | This module starts jobs to process Azure Security Center data for subscriptions and resources, either in automation or manual mode. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Invoke-ARISecurityCenterJob.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.5 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Invoke-ARISecurityCenterJob { 21 | Param($Subscriptions, $Automation, $Resources, $ARIModule) 22 | 23 | if ($Automation.IsPresent) 24 | { 25 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting SecurityCenter Job') 26 | Start-ThreadJob -Name 'Security' -ScriptBlock { 27 | 28 | import-module $($args[2]) 29 | 30 | $SecResult = Start-ARISecCenterJob -Subscriptions $($args[0]) -Security $($args[1]) 31 | 32 | $SecResult 33 | 34 | } -ArgumentList $Subscriptions , $SecurityCenter, $ARIModule | Out-Null 35 | } 36 | else 37 | { 38 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting SecurityCenter Job.') 39 | Start-Job -Name 'Security' -ScriptBlock { 40 | 41 | import-module $($args[2]) 42 | 43 | $SecResult = Start-ARISecCenterJob -Subscriptions $($args[0]) -Security $($args[1]) 44 | 45 | $SecResult 46 | 47 | } -ArgumentList $Subscriptions , $SecurityCenter, $ARIModule | Out-Null 48 | } 49 | } -------------------------------------------------------------------------------- /Modules/Private/2.ProcessingFunctions/Invoke-ARISubJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for invoking subscription processing jobs. 4 | 5 | .DESCRIPTION 6 | This module starts jobs to process Azure subscriptions and their associated resources, either in automation or manual mode. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Invoke-ARISubJob.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.5 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Invoke-ARISubJob { 21 | Param($Subscriptions, $Automation, $Resources, $CostData, $ARIModule) 22 | 23 | if ($Automation.IsPresent) 24 | { 25 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Subscription Job') 26 | Start-ThreadJob -Name 'Subscriptions' -ScriptBlock { 27 | 28 | import-module $($args[2]) 29 | 30 | $SubResult = Start-ARISubscriptionJob -Subscriptions $($args[0]) -Resources $($args[1]) -CostData $($args[3]) 31 | 32 | $SubResult 33 | 34 | } -ArgumentList $Subscriptions, $Resources, $ARIModule, $CostData | Out-Null 35 | } 36 | else 37 | { 38 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Subscription Job.') 39 | Start-Job -Name 'Subscriptions' -ScriptBlock { 40 | 41 | import-module $($args[2]) 42 | 43 | $SubResult = Start-ARISubscriptionJob -Subscriptions $($args[0]) -Resources $($args[1]) -CostData $($args[3]) 44 | 45 | $SubResult 46 | 47 | } -ArgumentList $Subscriptions, $Resources, $ARIModule, $CostData | Out-Null 48 | } 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Modules/Private/2.ProcessingFunctions/Start-ARIAutProcessJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module responsible for starting automated processing jobs for Azure Resources. 4 | 5 | .DESCRIPTION 6 | This module creates and manages automated thread jobs to process Azure Resources using PowerShell script blocks for efficient execution. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Start-ARIAutProcessJob.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI). 13 | 14 | .NOTES 15 | Version: 3.6.5 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Start-ARIAutProcessJob { 21 | Param($Resources, $Retirements, $Subscriptions, $InTag, $Unsupported) 22 | 23 | $ParentPath = (get-item $PSScriptRoot).parent.parent 24 | $InventoryModulesPath = Join-Path $ParentPath 'Public' 'InventoryModules' 25 | $Modules = Get-ChildItem -Path $InventoryModulesPath -Directory 26 | $NewResources = ($Resources | ConvertTo-Json -Depth 40 -Compress) 27 | $JobLoop = 1 28 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+"Starting ARI Automation Processing Jobs...") 29 | 30 | Foreach ($ModuleFolder in $Modules) 31 | { 32 | $ModulePath = Join-Path $ModuleFolder.FullName '*.ps1' 33 | $ModuleName = $ModuleFolder.Name 34 | $ModuleFiles = Get-ChildItem -Path $ModulePath 35 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+"Starting Job: $ModuleName") 36 | 37 | Start-ThreadJob -Name ('ResourceJob_'+$ModuleName) -ScriptBlock { 38 | 39 | $ModuleFiles = $($args[0]) 40 | $Subscriptions = $($args[2]) 41 | $InTag = $($args[3]) 42 | $Resources = $($args[4]) | ConvertFrom-Json 43 | $Retirements = $($args[5]) 44 | $Unsupported = $($args[10]) 45 | $SmaResources = @{} # Initialize the hashtable to store results 46 | 47 | Foreach ($Module in $ModuleFiles) 48 | { 49 | $ModuleFileContent = New-Object System.IO.StreamReader($Module.FullName) 50 | $ModuleData = $ModuleFileContent.ReadToEnd() 51 | $ModuleFileContent.Dispose() 52 | $ModName = $Module.Name.replace(".ps1","") 53 | 54 | $ScriptBlock = [Scriptblock]::Create($ModuleData) 55 | 56 | $SmaResources[$ModName] = Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $PSScriptRoot, $Subscriptions, $InTag, $Resources, $Retirements,'Processing', $null, $null, $null, $Unsupported 57 | 58 | Start-Sleep -Milliseconds 100 59 | 60 | } 61 | 62 | $SmaResources 63 | 64 | } -ArgumentList $ModuleFiles, $PSScriptRoot, $Subscriptions, $InTag, $NewResources, $Retirements, 'Processing', $null, $null, $null, $Unsupported | Out-Null 65 | 66 | if($JobLoop -eq 4) 67 | { 68 | Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Waiting Batch Jobs') 69 | 70 | Get-Job | Where-Object {$_.name -like 'ResourceJob_*'} | Wait-Job 71 | 72 | $JobNames = (Get-Job | Where-Object {$_.name -like 'ResourceJob_*'}).Name 73 | 74 | Start-Sleep -Seconds 5 75 | 76 | Build-ARICacheFiles -DefaultPath $DefaultPath -JobNames $JobNames 77 | 78 | $JobLoop = 0 79 | } 80 | $JobLoop ++ 81 | } 82 | } -------------------------------------------------------------------------------- /Modules/Private/3.ReportingFunctions/Build-ARIAdvisoryReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module for Advisory Report 4 | 5 | .DESCRIPTION 6 | This script processes and creates the Advisory sheet in the Excel report. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/3.ReportingFunctions/Build-ARIAdvisoryReport.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Build-ARIAdvisoryReport { 21 | param($File, $Adv, $TableStyle) 22 | $condtxtadv = @() 23 | $condtxtadv += New-ConditionalText High -Range E:E 24 | $condtxtadv += New-ConditionalText Security -Range D:D -BackgroundColor Wheat 25 | 26 | $Style = New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat '#,##0.00' -Range H:H 27 | 28 | [PSCustomObject]$Adv | 29 | ForEach-Object { $_ } | 30 | Select-Object 'ResourceGroup', 31 | 'Affected Resource Type', 32 | 'Name', 33 | 'Category', 34 | 'Impact', 35 | #'Score', 36 | 'Problem', 37 | 'Savings Currency', 38 | 'Annual Savings', 39 | 'Savings Region', 40 | 'Current SKU', 41 | 'Target SKU' | 42 | Export-Excel -Path $File -WorksheetName 'Advisor' -AutoSize -MaxAutoSizeRows 100 -TableName 'AzureAdvisory' -MoveToStart -TableStyle $tableStyle -Style $Style -ConditionalText $condtxtadv 43 | } -------------------------------------------------------------------------------- /Modules/Private/3.ReportingFunctions/Build-ARIPolicyReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module for Policy Report 4 | 5 | .DESCRIPTION 6 | This script processes and creates the Policy sheet in the Excel report. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/3.ReportingFunctions/Build-ARIPolicyReport.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Build-ARIPolicyReport { 21 | param($File ,$Pol, $TableStyle) 22 | if ($Pol) 23 | { 24 | $Style = New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat 0 25 | 26 | $condtxt = @() 27 | $condtxt += New-ConditionalText -Range B2:B500 -ConditionalType GreaterThan 0 28 | $condtxt += New-ConditionalText -Range C2:C500 -ConditionalType GreaterThan 0 29 | $condtxt += New-ConditionalText -Range H2:H500 -ConditionalType GreaterThan 0 30 | 31 | [PSCustomObject]$Pol | 32 | ForEach-Object { $_ } | 33 | Select-Object 'Initiative', 34 | 'Initiative Non Compliance Resources', 35 | 'Initiative Non Compliance Policies', 36 | 'Policy', 37 | 'Policy Type', 38 | 'Effect', 39 | 'Compliance Resources', 40 | 'Non Compliance Resources', 41 | 'Unknown Resources', 42 | 'Exempt Resources', 43 | 'Policy Mode', 44 | 'Policy Version', 45 | 'Policy Deprecated', 46 | 'Policy Category' | Export-Excel -Path $File -WorksheetName 'Policy' -AutoSize -MaxAutoSizeRows 100 -TableName 'AzurePolicy' -MoveToStart -ConditionalText $condtxt -TableStyle $tableStyle -Style $Style 47 | } 48 | } -------------------------------------------------------------------------------- /Modules/Private/3.ReportingFunctions/Build-ARIQuotaReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module for Quota Report 4 | 5 | .DESCRIPTION 6 | This script processes and creates the Quota Usage sheet in the Excel report. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/3.ReportingFunctions/Build-ARIQuotaReport.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Build-ARIQuotaReport { 21 | param($File, $AzQuota, $TableStyle) 22 | 23 | $Total = ($AzQuota.properties.Data).count 24 | $tmp = foreach($Quota in $AzQuota.properties) 25 | { 26 | foreach($Data in $Quota.Data) 27 | { 28 | $FreevCPU = '' 29 | if($Data.Name.LocalizedValue -like '*vCPUs'){$FreevCPU = $Data.limit - $Data.CurrentValue} 30 | $obj = @{ 31 | 'Subscription' = $Quota.Subscription; 32 | 'Region' = $Quota.Location; 33 | 'Current Usage' = $Data.currentValue; 34 | 'Limit' = $Data.limit; 35 | 'Quota' = $Data.Name.LocalizedValue; 36 | 'vCPUs Available' = $FreevCPU; 37 | 'Total' = $Total 38 | } 39 | $obj 40 | } 41 | } 42 | 43 | $ExcelVar = $tmp 44 | 45 | $TableName = ('QuotaTable_'+$ExcelVar[0].Total) 46 | [PSCustomObject]$ExcelVar | 47 | ForEach-Object { $_ } | 48 | Select-Object -Unique 'Subscription', 49 | 'Region', 50 | 'Current Usage', 51 | 'Limit', 52 | 'Quota', 53 | 'vCPUs Available' | 54 | Export-Excel -Path $File -WorksheetName 'Quota Usage' -AutoSize -MaxAutoSizeRows 100 -TableName $TableName -TableStyle $TableStyle -Numberformat '0' -MoveToEnd 55 | } -------------------------------------------------------------------------------- /Modules/Private/3.ReportingFunctions/Build-ARISecCenterReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module for Security Center Report 4 | 5 | .DESCRIPTION 6 | This script processes and creates the Security Center sheet in the Excel report. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/3.ReportingFunctions/Build-ARISecCenterReport.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Build-ARISecCenterReport { 21 | param($File, $Sec, $TableStyle) 22 | $condtxtsec = $(New-ConditionalText High -Range G:G 23 | New-ConditionalText High -Range L:L) 24 | 25 | [PSCustomObject]$Sec | 26 | ForEach-Object { $_ } | 27 | Select-Object 'Subscription', 28 | 'Resource Group', 29 | 'Resource Type', 30 | 'Resource Name', 31 | 'Categories', 32 | 'Control', 33 | 'Severity', 34 | 'Status', 35 | 'Remediation', 36 | 'Remediation Effort', 37 | 'User Impact', 38 | 'Threats' | 39 | Export-Excel -Path $File -WorksheetName 'SecurityCenter' -AutoSize -MaxAutoSizeRows 100 -MoveToStart -TableName 'SecurityCenter' -TableStyle $tableStyle -ConditionalText $condtxtsec 40 | } -------------------------------------------------------------------------------- /Modules/Private/3.ReportingFunctions/Build-ARISubsReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module for Subscription Report 4 | 5 | .DESCRIPTION 6 | This script processes and creates the Subscription sheet in the Excel report. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/3.ReportingFunctions/Build-ARISubsReport.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Build-ARISubsReport { 21 | param($File, $Sub, $IncludeCosts, $TableStyle) 22 | $TableName = ('SubsTable_'+($Sub.Subscription | Select-Object -Unique).count) 23 | 24 | if ($IncludeCosts.IsPresent) 25 | { 26 | $Style = @() 27 | $Style += New-ExcelStyle -AutoSize -HorizontalAlignment Center -NumberFormat '0' 28 | $Style += New-ExcelStyle -Width 55 -NumberFormat '$#,#########0.000000000' -Range J:J 29 | $Style += New-ExcelStyle -AutoSize -NumberFormat '$#,##0.00' -Range I:I 30 | [PSCustomObject]$Sub | 31 | ForEach-Object { $_ } | 32 | Select-Object 'Subscription', 33 | 'Resource Group', 34 | 'Location', 35 | 'Resource Type', 36 | 'Service Name', 37 | 'Currency', 38 | 'Month', 39 | 'Year', 40 | 'Cost', 41 | 'Detailed Cost' | Export-Excel -Path $File -WorksheetName 'Subscriptions' -TableName $TableName -TableStyle $TableStyle -Style $Style 42 | 43 | } 44 | else 45 | { 46 | $Style = New-ExcelStyle -HorizontalAlignment Center -NumberFormat '0' 47 | [PSCustomObject]$Sub | 48 | ForEach-Object { $_ } | 49 | Select-Object 'Subscription', 50 | 'Resource Group', 51 | 'Location', 52 | 'Resource Type', 53 | 'Resources Count' | Export-Excel -Path $File -WorksheetName 'Subscriptions' -TableName $TableName -AutoSize -MaxAutoSizeRows 100 -TableStyle $TableStyle -Style $Style 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /Modules/Private/3.ReportingFunctions/Start-ARIExcelJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module for Excel Job Processing 4 | 5 | .DESCRIPTION 6 | This script processes inventory modules and builds the Excel report. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/3.ReportingFunctions/Start-ARIExcelJob.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Start-ARIExcelJob { 21 | Param($ReportCache, $File, $TableStyle) 22 | 23 | $ParentPath = (get-item $PSScriptRoot).parent.parent 24 | $InventoryModulesPath = Join-Path $ParentPath 'Public' 'InventoryModules' 25 | $ModuleFolders = Get-ChildItem -Path $InventoryModulesPath -Directory 26 | 27 | Write-Progress -activity 'Azure Inventory' -Status "68% Complete." -PercentComplete 68 -CurrentOperation "Starting the Report Loop.." 28 | 29 | $ModulesCount = [string](Get-ChildItem -Path $InventoryModulesPath -Recurse -Filter "*.ps1").count 30 | 31 | Write-Output 'Starting to Build Excel Report.' 32 | Write-Host 'Supported Resource Types: ' -NoNewline -ForegroundColor Green 33 | Write-Host $ModulesCount -ForegroundColor Cyan 34 | 35 | $Lops = $ModulesCount 36 | $ReportCounter = 0 37 | 38 | Foreach ($ModuleFolder in $ModuleFolders) 39 | { 40 | $CacheData = $null 41 | $ModulePath = Join-Path $ModuleFolder.FullName '*.ps1' 42 | $ModuleFiles = Get-ChildItem -Path $ModulePath 43 | 44 | $CacheFiles = Get-ChildItem -Path $ReportCache -Recurse 45 | $JSONFileName = ($ModuleFolder.Name + '.json') 46 | $CacheFile = $CacheFiles | Where-Object { $_.Name -like "*$JSONFileName" } 47 | 48 | if ($CacheFile) 49 | { 50 | $CacheFileContent = New-Object System.IO.StreamReader($CacheFile.FullName) 51 | $CacheData = $CacheFileContent.ReadToEnd() 52 | $CacheFileContent.Dispose() 53 | $CacheData = $CacheData | ConvertFrom-Json 54 | } 55 | 56 | Foreach ($Module in $ModuleFiles) 57 | { 58 | $c = (($ReportCounter / $Lops) * 100) 59 | $c = [math]::Round($c) 60 | Write-Progress -Id 1 -activity "Building Report" -Status "$c% Complete." -PercentComplete $c 61 | 62 | $ModuleFileContent = New-Object System.IO.StreamReader($Module.FullName) 63 | $ModuleData = $ModuleFileContent.ReadToEnd() 64 | $ModuleFileContent.Dispose() 65 | $ModName = $Module.Name.replace(".ps1","") 66 | 67 | $SmaResources = $CacheData.$ModName 68 | 69 | $ModuleResourceCount = $SmaResources.count 70 | 71 | if ($ModuleResourceCount -gt 0) 72 | { 73 | Start-Sleep -Milliseconds 25 74 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+"Running Module: '$ModName'. Excel Rows: $ModuleResourceCount") 75 | 76 | $ScriptBlock = [Scriptblock]::Create($ModuleData) 77 | 78 | Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $PSScriptRoot, $null, $InTag, $null, $null, 'Reporting', $file, $SmaResources, $TableStyle, $null 79 | 80 | } 81 | 82 | $ReportCounter ++ 83 | 84 | } 85 | Remove-Variable -Name CacheData 86 | Remove-Variable -Name SmaResources 87 | Clear-ARIMemory 88 | } 89 | Write-Progress -Id 1 -activity "Building Report" -Status "100% Complete." -Completed 90 | } -------------------------------------------------------------------------------- /Modules/Private/3.ReportingFunctions/StyleFunctions/Out-ARIReportResults.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module for Reporting Results Output 4 | 5 | .DESCRIPTION 6 | This script outputs the results of the Azure Resource Inventory report generation. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/3.ReportingFunctions/StyleFunctions/Out-ARIReportResults.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Out-ARIReportResults { 21 | param ( 22 | [string]$Measure, 23 | [string]$ResourcesCount, 24 | [string]$TotalRes, 25 | [string]$File, 26 | [string]$AdvisoryData, 27 | [string]$PolicyData, 28 | [string]$SecurityCenterData, 29 | [string]$DDFile, 30 | $SkipAdvisory, 31 | $SkipPolicy, 32 | $SecurityCenter, 33 | $SkipAPIs, 34 | $SkipDiagram 35 | ) 36 | 37 | Write-Host ('Report Complete. Total Runtime was: ') -NoNewline -ForegroundColor Green 38 | Write-Host $Measure -ForegroundColor Cyan 39 | Write-Host ('Total Resources on Azure: ') -NoNewline 40 | Write-Host $ResourcesCount -ForegroundColor Cyan 41 | Write-Host ('Total Resources on Excel: ') -NoNewline 42 | Write-Host $TotalRes -ForegroundColor Cyan 43 | if (!$SkipAdvisory.IsPresent) 44 | { 45 | if(![string]::IsNullOrEmpty($AdvisoryData)) 46 | { 47 | Write-Host ('Total Advisories: ') -NoNewline 48 | write-host $AdvisoryData -ForegroundColor Cyan 49 | } 50 | } 51 | if (!$SkipPolicy.IsPresent -and !$SkipAPIs.IsPresent) 52 | { 53 | if(![string]::IsNullOrEmpty($PolicyData)) 54 | { 55 | Write-Host ('Total Policies: ') -NoNewline 56 | write-host $PolicyData -ForegroundColor Cyan 57 | } 58 | } 59 | if ($SecurityCenter.IsPresent) 60 | { 61 | if(![string]::IsNullOrEmpty($SecurityCenterData)) 62 | { 63 | Write-Host ('Total Security Advisories: ' + $SecurityCenterData) 64 | } 65 | } 66 | 67 | Write-Host '' 68 | Write-Host ('Excel file saved at: ') -NoNewline 69 | write-host $File -ForegroundColor Cyan 70 | Write-Host '' 71 | 72 | if(!$SkipDiagram.IsPresent) 73 | { 74 | Write-Host ('Draw.io Diagram file saved at: ') -NoNewline 75 | write-host $DDFile -ForegroundColor Cyan 76 | Write-Host '' 77 | } 78 | } -------------------------------------------------------------------------------- /Modules/Private/3.ReportingFunctions/StyleFunctions/Start-ARIExcelCustomization.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module for Main Dashboard 4 | 5 | .DESCRIPTION 6 | This script process and creates the Overview sheet. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/3.ReportingFunctions/StyleFunctions/Start-ARIExcelCustomization.ps1 10 | 11 | .COMPONENT 12 | This powershell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Start-ARIExcelCustomization { 21 | param($File, $TableStyle, $PlatOS, $Subscriptions, $ExtractionRunTime, $ProcessingRunTime, $ReportingRunTime, $IncludeCosts, $RunLite, $Overview) 22 | 23 | Write-Progress -activity 'Azure Inventory' -Status "85% Complete." -PercentComplete 85 -CurrentOperation "Starting Excel Customization.." 24 | 25 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Excel Charts Customization.') 26 | 27 | if ($RunLite) 28 | { 29 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Running in Lite Mode.') 30 | 31 | $ScriptVersion = "3.6" 32 | } 33 | else 34 | { 35 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Running in Full Mode.') 36 | $ARIMod = Get-InstalledModule -Name AzureResourceInventory 37 | 38 | $ScriptVersion = [string]$ARIMod.Version 39 | } 40 | 41 | 42 | "" | Export-Excel -Path $File -WorksheetName 'Overview' -MoveToStart 43 | 44 | Start-ARIExcelOrdening -File $File 45 | 46 | $Excel = Open-ExcelPackage -Path $File 47 | $Worksheets = $Excel.Workbook.Worksheets 48 | 49 | $TotalRes = 0 50 | $Table = Foreach ($WorkS in $Worksheets) { 51 | if(![string]::IsNullOrEmpty($WorkS.Tables.Name)) 52 | { 53 | $Number = $WorkS.Tables.Name.split('_') 54 | $tmp = @{ 55 | 'Name' = $WorkS.name; 56 | 'Size' = [int]$Number[1]; 57 | 'Size2' = if ($WorkS.name -in ('Subscriptions', 'Quota Usage', 'AdvisorScore', 'Outages', 'SupportTickets', 'Reservation Advisor')) {0}else{[int]$Number[1]} 58 | } 59 | if ($WorkS.name -notin ('Subscriptions', 'Quota Usage', 'AdvisorScore', 'Outages', 'SupportTickets', 'Reservation Advisor', 'Managed Identity', 'Backup')) 60 | { 61 | $TotalRes = $TotalRes + ([int]$Number[1]) 62 | } 63 | $tmp 64 | } 65 | } 66 | 67 | Close-ExcelPackage $Excel 68 | 69 | $TableStyleEx = if($PlatOS -eq 'PowerShell Desktop'){'Medium1'}else{$TableStyle} 70 | $TableStyle = if($PlatOS -eq 'PowerShell Desktop'){'Medium15'}else{$TableStyle} 71 | #$TableStyle = 'Medium22' 72 | 73 | $Style = New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat 0 74 | 75 | $Table | 76 | ForEach-Object { [PSCustomObject]$_ } | Sort-Object -Property 'Size2' -Descending | 77 | Select-Object -Unique 'Name', 78 | 'Size' | Export-Excel -Path $File -WorksheetName 'Overview' -AutoSize -MaxAutoSizeRows 100 -TableName 'AzureTabs' -TableStyle $TableStyleEx -Style $Style -StartRow 6 -StartColumn 1 79 | 80 | $Excel = Open-ExcelPackage -Path $File 81 | 82 | Build-ARIInitialBlock -Excel $Excel -ExtractionRunTime $ExtractionRunTime -ProcessingRunTime $ProcessingRunTime -ReportingRunTime $ReportingRunTime -PlatOS $PlatOS -TotalRes $TotalRes -ScriptVersion $ScriptVersion 83 | 84 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Creating Charts.') 85 | 86 | Build-ARIExcelChart -Excel $Excel -Overview $Overview -IncludeCosts $IncludeCosts 87 | 88 | Close-ExcelPackage $Excel 89 | 90 | if(!$RunLite) 91 | { 92 | Build-ARIExcelComObject -File $File 93 | } 94 | 95 | return $TotalRes 96 | } -------------------------------------------------------------------------------- /Modules/Private/3.ReportingFunctions/StyleFunctions/Start-ARIExcelOrdening.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Module for Excel Sheet Ordering 4 | 5 | .DESCRIPTION 6 | This script organizes the order of sheets in the Excel report. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Private/3.ReportingFunctions/StyleFunctions/Start-ARIExcelOrdening.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | #> 19 | 20 | function Start-ARIExcelOrdening { 21 | Param($File) 22 | 23 | $Excel = Open-ExcelPackage -Path $File 24 | $Worksheets = $Excel.Workbook.Worksheets 25 | 26 | $Order = $Worksheets | Where-Object { $_.Name -notin 'Overview','Policy', 'Advisor', 'Security Center', 'Subscriptions', 'Quota Usage', 'AdvisorScore', 'Outages', 'Support Tickets', 'Reservation Advisor' } | Select-Object -Property Index, name, @{N = "Dimension"; E = { $_.dimension.Rows - 1 } } | Sort-Object -Property Dimension -Descending 27 | 28 | $Order0 = $Order | Where-Object { $_.Name -ne $Order[0].name -and $_.Name -ne ($Order | select-object -Last 1).Name } 29 | 30 | #$Worksheets.MoveAfter(($Order | select-object -Last 1).Name, 'Subscriptions') 31 | 32 | $Loop = 0 33 | 34 | Foreach ($Ord in $Order0) { 35 | if ($Ord.Index -and $Loop -ne 0) { 36 | $Worksheets.MoveAfter($Ord.Name, $Order0[$Loop - 1].Name) 37 | } 38 | if ($Loop -eq 0) { 39 | $Worksheets.MoveAfter($Ord.Name, $Order[0].Name) 40 | } 41 | $Loop++ 42 | } 43 | 44 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Validating if Advisor and Policies are included.') 45 | if (($Worksheets | Where-Object { $_.Name -eq 'Advisor'})) 46 | { 47 | $Worksheets.MoveAfter('Advisor', 'Overview') 48 | } 49 | if (($Worksheets | Where-Object { $_.Name -eq 'Policy'})) 50 | { 51 | $Worksheets.MoveAfter('Policy', 'Overview') 52 | } 53 | if (($Worksheets | Where-Object { $_.Name -eq 'Security Center'})) 54 | { 55 | $Worksheets.MoveAfter('Security Center', 'Overview') 56 | } 57 | if (($Worksheets | Where-Object {$_.Name -eq 'Quota Usage'})) 58 | { 59 | $Worksheets.MoveAfter('Quota Usage', 'Overview') 60 | } 61 | if (($Worksheets | Where-Object {$_.Name -eq 'AdvisorScore'})) 62 | { 63 | $Worksheets.MoveAfter('AdvisorScore', 'Overview') 64 | } 65 | if (($Worksheets | Where-Object {$_.Name -eq 'Support Tickets'})) 66 | { 67 | $Worksheets.MoveAfter('Support Tickets', 'Overview') 68 | } 69 | if (($Worksheets | Where-Object {$_.Name -eq 'Reservation Advisor'})) 70 | { 71 | $Worksheets.MoveAfter('Reservation Advisor', 'Overview') 72 | } 73 | $Worksheets.MoveAfter('Subscriptions','Overview') 74 | 75 | $WS = $Excel.Workbook.Worksheets | Where-Object { $_.Name -eq 'Overview' } 76 | 77 | $WS.SetValue(75,70,'') 78 | $WS.SetValue(76,70,'') 79 | $WS.View.ShowGridLines = $false 80 | 81 | $TabDraw = $WS.Drawings.AddShape('TP00', 'RoundRect') 82 | $TabDraw.SetSize(130 , 78) 83 | $TabDraw.SetPosition(1, 0, 0, 0) 84 | $TabDraw.TextAlignment = 'Center' 85 | 86 | Close-ExcelPackage $Excel 87 | 88 | } -------------------------------------------------------------------------------- /Modules/Private/4.RAMPFunctions/Export-ARIFedRamp.ps1: -------------------------------------------------------------------------------- 1 | function Export-ARIFedRamp { 2 | Param($FedRampResources, $DefaultPath, $RAMPFile) 3 | 4 | $FedRampTemplateFile = Join-Path $PSScriptRoot 'FedRAMP-Inventory-Template.xlsx' 5 | 6 | $TableStyle = 'Light19' 7 | 8 | $Style = @() 9 | $Style += New-ExcelStyle -HorizontalAlignment Center -WrapText -Range B:Y 10 | $Style += New-ExcelStyle -VerticalAlignment Center -Range A:Y 11 | $Style += New-ExcelStyle -HorizontalAlignment Center -Range A2:Y2 12 | 13 | $FedRampTemplate = Open-ExcelPackage -Path $FedRampTemplateFile 14 | 15 | $null = $FedRampResources | ForEach-Object { $_ } | 16 | Export-Excel -ExcelPackage $FedRampTemplate -WorksheetName 'Inventory' -TableName 'SSPInventory' -TableStyle $TableStyle -Style $Style -StartRow 2 -PassThru 17 | 18 | Close-ExcelPackage -ExcelPackage $FedRampTemplate -SaveAs $RAMPFile 19 | } -------------------------------------------------------------------------------- /Modules/Private/4.RAMPFunctions/Export-ARIStateRamp.ps1: -------------------------------------------------------------------------------- 1 | function Export-ARIStateRamp { 2 | Param($StateRampResources, $DefaultPath, $RAMPFile) 3 | 4 | $StateRampTemplateFile = Join-Path $PSScriptRoot 'StateRAMP-Inventory-Template.xlsx' 5 | 6 | $TableStyle = 'Light19' 7 | 8 | $Style = @() 9 | $Style += New-ExcelStyle -HorizontalAlignment Center -WrapText -Range B:X 10 | $Style += New-ExcelStyle -VerticalAlignment Center -Range A:X 11 | $Style += New-ExcelStyle -HorizontalAlignment Center -Range A2:X2 12 | 13 | $StateRampTemplate = Open-ExcelPackage -Path $StateRampTemplateFile 14 | 15 | $null = $StateRampResources | ForEach-Object { $_ } | 16 | Export-Excel -ExcelPackage $StateRampTemplate -WorksheetName 'Inventory' -TableName 'SSPInventory' -TableStyle $TableStyle -Style $Style -StartRow 2 -PassThru 17 | 18 | Close-ExcelPackage -ExcelPackage $StateRampTemplate -SaveAs $RAMPFile 19 | } -------------------------------------------------------------------------------- /Modules/Private/4.RAMPFunctions/FedRAMP-Inventory-Template.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/Modules/Private/4.RAMPFunctions/FedRAMP-Inventory-Template.xlsx -------------------------------------------------------------------------------- /Modules/Private/4.RAMPFunctions/Start-ARIMappingFedRAMP.ps1: -------------------------------------------------------------------------------- 1 | function Start-ARIMappingFedRAMP { 2 | Param($FedResources) 3 | 4 | $FedRampResources = Foreach ($FedResource in $FedResources) 5 | { 6 | $MappedResource = [PSCustomObject]@{ 7 | 'UNIQUE ASSET IDENTIFIER' = $FedResource.FedID 8 | 'IPv4 or IPv6 Address' = $FedResource.FedIPAddress 9 | 'Virtual' = $FedResource.FedVirtual 10 | 'Public' = $FedResource.FedPublic 11 | 'DNS Name or URL' = $FedResource.FedDNSName 12 | 'NetBIOS Name' = $FedResource.FedNetBIOSName 13 | 'MAC Address' = $FedResource.FedMACAddress 14 | 'Authenticated Scan' = $FedResource.FedAuthenticatedScan 15 | 'Baseline Configuration Name' = $FedResource.FedBaselineConfigurationName 16 | 'OS Name and Version' = $FedResource.FedOSNameAndVersion 17 | 'Location' = $FedResource.FedLocation 18 | 'Asset Type' = $FedResource.FedAssetType 19 | 'Hardware Make/Model' = $FedResource.FedHardwareMakeModel 20 | 'In Latest Scan' = $FedResource.FedInLatestScan 21 | 'Software/ Database Vendor' = $FedResource.FedSoftwareDatabaseVendor 22 | 'Software/ Database Name & Version' = $FedResource.FedSoftwareDatabaseNameAndVersion 23 | 'Patch Level' = $FedResource.FedPatchLevel 24 | 'Diagram Label' = '' 25 | 'Comments' = $FedResource.FedComments 26 | 'Serial #/Asset Tag#' = $FedResource.FedSerialAssetTag 27 | 'VLAN/_x000a_Network ID' = $FedResource.FedVLANNetworkID 28 | 'System Administrator/ Owner' = $FedResource.FedSystemAdministratorOwner 29 | 'Application Administrator/ Owner' = $FedResource.FedApplicationAdministratorOwner 30 | 'Function' = $FedResource.FedFunction 31 | 'End-of-Life' = '' 32 | } 33 | $MappedResource 34 | } 35 | 36 | return $FedRampResources 37 | } -------------------------------------------------------------------------------- /Modules/Private/4.RAMPFunctions/Start-ARIMappingStateRAMP.ps1: -------------------------------------------------------------------------------- 1 | function Start-ARIMappingStateRAMP { 2 | Param($StateResources) 3 | 4 | $StateRAMP = Foreach ($StateResource in $StateResources) 5 | { 6 | $MappedResource = [PSCustomObject]@{ 7 | 'UNIQUE ASSET IDENTIFIER' = $StateResource.FedID 8 | 'IPv4 or IPv6_x000a_Address' = $StateResource.FedIPAddress 9 | 'Virtual' = $StateResource.FedVirtual 10 | 'Public' = $StateResource.FedPublic 11 | 'DNS Name or URL' = $StateResource.FedDNSName 12 | 'NetBIOS Name' = $StateResource.FedNetBIOSName 13 | 'MAC Address' = $StateResource.FedMACAddress 14 | 'Authenticated Scan' = $StateResource.FedAuthenticatedScan 15 | 'Baseline Configuration Name' = $StateResource.FedBaselineConfigurationName 16 | 'OS Name and Version' = $StateResource.FedOSNameAndVersion 17 | 'Location' = $StateResource.FedLocation 18 | 'Asset Type' = $StateResource.FedAssetType 19 | 'Hardware Make/Model' = $StateResource.FedHardwareMakeModel 20 | 'In Latest Scan' = $StateResource.FedInLatestScan 21 | 'Software/ Database Vendor' = $StateResource.FedSoftwareDatabaseVendor 22 | 'Software/ Database Name & Version' = $StateResource.FedSoftwareDatabaseNameAndVersion 23 | 'Patch Level' = $StateResource.FedPatchLevel 24 | 'Function' = $StateResource.FedFunction 25 | 'Comments' = $StateResource.FedComments 26 | 'Serial #/Asset Tag#' = $StateResource.FedSerialAssetTag 27 | 'VLAN/_x000a_Network ID' = $StateResource.FedVLANNetworkID 28 | 'System Administrator/ Owner' = $StateResource.FedSystemAdministratorOwner 29 | 'Application Administrator/ Owner' = $StateResource.FedApplicationAdministratorOwner 30 | } 31 | $MappedResource 32 | } 33 | 34 | return $StateRAMP 35 | } -------------------------------------------------------------------------------- /Modules/Private/4.RAMPFunctions/StateRAMP-Inventory-Template.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/Modules/Private/4.RAMPFunctions/StateRAMP-Inventory-Template.xlsx -------------------------------------------------------------------------------- /Modules/Private/LegacyFunctions/Build-ARILargeReportResources.ps2: -------------------------------------------------------------------------------- 1 | function Build-ARILargeReportResources { 2 | Param($DefaultPath, $Debug) 3 | if ($Debug.IsPresent) 4 | { 5 | $DebugPreference = 'Continue' 6 | $ErrorActionPreference = 'Continue' 7 | } 8 | else 9 | { 10 | $ErrorActionPreference = "silentlycontinue" 11 | } 12 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Looking for Cache Files.') 13 | $LocalCacheFilePath = Join-Path $DefaultPath 'ReportCache' '*.json' 14 | $LocalCacheFiles = Get-ChildItem -Path $LocalCacheFilePath 15 | 16 | $Looper = 0 17 | 18 | foreach ($LocalFile in $LocalCacheFiles) 19 | { 20 | $Looper ++ 21 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Resource Excel Data Processing Jobs.') 22 | Start-job -Name ('ExcelJob_'+$Looper) -ScriptBlock { 23 | 24 | $LocalFile = $($args[1]) 25 | $DefaultPath = $($args[2]) 26 | $LocalFolder = $LocalFile.Name.replace(".json","") 27 | 28 | $ParentPath = (get-item $($args[0])).parent.parent 29 | $InventoryModulesPath = Join-Path $ParentPath 'Public' 'InventoryModules' '*.ps1' 30 | $Modules = Get-ChildItem -Path $InventoryModulesPath -Recurse 31 | 32 | $ModFolder = Join-Path $DefaultPath 'ReportCache' $LocalFolder 33 | if ((Test-Path -Path $ModFolder -PathType Container) -eq $false) { 34 | New-Item -Type Directory -Force -Path $ModFolder | Out-Null 35 | } 36 | 37 | $TempContent = Get-Content -Path $LocalFile | ConvertFrom-Json 38 | 39 | $job = @() 40 | 41 | $Modules | ForEach-Object { 42 | $ModName = $_.Name.replace(".ps1","") 43 | if($TempContent.$ModName.count -gt 0) 44 | { 45 | $TempVal = $TempContent.$ModName 46 | $ModNameFile = ($ModName+'.json') 47 | Start-Sleep -Milliseconds 100 48 | 49 | New-Variable -Name ('ModRun' + $ModName) 50 | New-Variable -Name ('ModJob' + $ModName) 51 | 52 | Set-Variable -Name ('ModRun' + $ModName) -Value ([PowerShell]::Create()).AddScript({Param($ModFolder,$TempVal,$ModNameFile)$TempVal | ConvertTo-Json -Depth 50 | Out-File -FilePath ($ModFolder+$ModNameFile)}).AddArgument($ModFolder).AddArgument($TempVal).AddArgument($ModNameFile) 53 | 54 | Set-Variable -Name ('ModJob' + $ModName) -Value ((get-variable -name ('ModRun' + $ModName)).Value).BeginInvoke() 55 | 56 | Start-Sleep -Milliseconds 100 57 | 58 | $job += (get-variable -name ('ModJob' + $ModName)).Value 59 | Remove-Variable -Name ModName 60 | } 61 | } 62 | 63 | while ($Job.Runspace.IsCompleted -contains $false) { Start-Sleep -Milliseconds 1000 } 64 | 65 | $Modules | ForEach-Object { 66 | $ModName = $_.Name.replace(".ps1","") 67 | if($TempContent.$ModName.count -gt 0) 68 | { 69 | Remove-Variable -Name ('ModRun' + $ModName) 70 | Remove-Variable -Name ('ModJob' + $ModName) 71 | Remove-Variable -Name ModName 72 | } 73 | } 74 | 75 | [System.GC]::Collect() | out-null 76 | Start-Sleep -Milliseconds 50 77 | 78 | } -ArgumentList $PSScriptRoot, $LocalFile, $DefaultPath 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /Modules/Private/LegacyFunctions/Start-ARIAutResourceJob.ps2: -------------------------------------------------------------------------------- 1 | function Start-ARIAutResourceJob { 2 | Param($Resources,$Subscriptions,$InTag,$Unsupported) 3 | Write-Output ('Starting Resources Processes') 4 | Write-Output ('Total Resources Being Analyzed: '+$Resources.count) 5 | 6 | $ParentPath = (get-item $PSScriptRoot).parent.parent 7 | 8 | $InventoryModulesPath = Join-Path $ParentPath 'Public' 'InventoryModules' '*.ps1' 9 | 10 | $Modules = Get-ChildItem -Path $InventoryModulesPath -Recurse 11 | 12 | $SmaResources = @{} 13 | 14 | foreach ($Module in $Modules) 15 | { 16 | 17 | if($RunDebug) 18 | { 19 | Write-Output '' 20 | Write-Output ('DEBUG - Running Module: '+$Module) 21 | } 22 | 23 | $ModName = $Module.Name.replace(".ps1","") 24 | $ModuSeq0 = New-Object System.IO.StreamReader($Module.FullName) 25 | $ModuSeq = $ModuSeq0.ReadToEnd() 26 | $ModuSeq0.Dispose() 27 | 28 | $ScriptBlock = [Scriptblock]::Create($ModuSeq) 29 | 30 | $SmaResources[$ModName] = Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $PSScriptRoot, $Subscriptions, $InTag, $Resources, $null,'Processing', $null, $null, $null, $Unsupported 31 | 32 | Start-Sleep -Milliseconds 100 33 | 34 | } 35 | return $SmaResources 36 | } -------------------------------------------------------------------------------- /Modules/Private/LegacyFunctions/Start-ARILargeEnvOrderFiles.ps2: -------------------------------------------------------------------------------- 1 | function Start-ARILargeEnvOrderFiles { 2 | Param($DefaultPath,$Debug) 3 | if ($Debug.IsPresent) 4 | { 5 | $DebugPreference = 'Continue' 6 | $ErrorActionPreference = 'Continue' 7 | } 8 | else 9 | { 10 | $ErrorActionPreference = "silentlycontinue" 11 | } 12 | 13 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Ordering Cached Files.') 14 | 15 | $ParentPath = (get-item $PSScriptRoot).parent.parent 16 | $InventoryModulesPath = Join-Path $ParentPath 'Public' 'InventoryModules' '*.ps1' 17 | $Modules = Get-ChildItem -Path $InventoryModulesPath -Recurse 18 | $ModFolder = Join-Path $DefaultPath 'ReportCache' 'ResourceCache' 19 | if ((Test-Path -Path $ModFolder -PathType Container) -eq $false) { 20 | New-Item -Type Directory -Force -Path $ModFolder | Out-Null 21 | } 22 | 23 | foreach ($Module in $Modules) 24 | { 25 | $ModuleName = $Module.name.replace('.ps1','') 26 | $ModuleContentFile = ($ModuleName+'.json') 27 | $ModuleContentPath = Join-Path $DefaultPath 'ReportCache' 'ResourceJob_*' $ModuleContentFile 28 | if (Test-Path -Path $ModuleContentPath -PathType Leaf) 29 | { 30 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Merging Cached File for: '+$ModuleName) 31 | $ModContent = Get-ChildItem -Path $ModuleContentPath | ForEach-Object {Get-Content -Path $_ | ConvertFrom-Json} 32 | $ModFinalFile = Join-Path $ModFolder $ModuleContentFile 33 | $ModContent | ConvertTo-Json -Depth 40 | Out-File -FilePath $ModFinalFile 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Modules/Private/LegacyFunctions/Start-ARIResourceReporting.ps2: -------------------------------------------------------------------------------- 1 | function Start-ARIResourceReporting { 2 | Param($InTag, $file, $SmaResources, $DefaultPath, $TableStyle, $Unsupported, $DebugEnvSize, $DataActive, $Debug) 3 | if ($Debug.IsPresent) 4 | { 5 | $DebugPreference = 'Continue' 6 | $ErrorActionPreference = 'Continue' 7 | } 8 | else 9 | { 10 | $ErrorActionPreference = "silentlycontinue" 11 | } 12 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Reporting Phase.') 13 | Write-Progress -activity $DataActive -Status "Processing Inventory" -PercentComplete 50 14 | 15 | $ParentPath = (get-item $PSScriptRoot).parent.parent 16 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Running Asynchronous, Gathering List Of Modules.') 17 | 18 | $InventoryModulesPath = Join-Path $ParentPath 'Public' 'InventoryModules' '*.ps1' 19 | $Modules = Get-ChildItem -Path $InventoryModulesPath -Recurse 20 | 21 | 22 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Modules Found: ' + $Modules.Count) 23 | $Lops = $Modules.count 24 | $ReportCounter = 0 25 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Large Environment. Looking for Cached Resource Files.') 26 | 27 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting to Process Modules.') 28 | foreach ($Module in $Modules) { 29 | 30 | $c = (($ReportCounter / $Lops) * 100) 31 | $c = [math]::Round($c) 32 | Write-Progress -Id 1 -activity "Building Report" -Status "$c% Complete." -PercentComplete $c 33 | 34 | $ModuSeq0 = New-Object System.IO.StreamReader($Module.FullName) 35 | $ModuSeq = $ModuSeq0.ReadToEnd() 36 | $ModuSeq0.Dispose() 37 | $ModuleName = $Module.name.replace('.ps1','') 38 | 39 | if ($DebugEnvSize -eq 'Large') 40 | { 41 | $SmaResources = @{} 42 | $ModuleFileName = $ModuleName + '.json' 43 | $ModuleFilePath = Join-Path $DefaultPath 'ReportCache' 'ResourceCache' $ModuleFileName 44 | if (Test-Path -Path $ModuleFilePath -PathType Leaf) 45 | { 46 | $SmaResources["$ModuleName"] = Get-Content -Path $ModuleFilePath | ConvertFrom-Json 47 | } 48 | else 49 | { 50 | $SmaResources["$ModuleName"] = 0 51 | } 52 | } 53 | 54 | $ModuleResourceCount = $SmaResources.$ModuleName.count 55 | 56 | if ($ModuleResourceCount -gt 0) 57 | { 58 | Start-Sleep -Milliseconds 25 59 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+"Running Module: '$ModuleName'. Lines Count: $ModuleResourceCount") 60 | 61 | $ExcelRun = ([PowerShell]::Create()).AddScript($ModuSeq).AddArgument($PSScriptRoot).AddArgument($null).AddArgument($InTag).AddArgument($null).AddArgument($null).AddArgument('Reporting').AddArgument($file).AddArgument($SmaResources).AddArgument($TableStyle).AddArgument($Unsupported) 62 | 63 | $ExcelJob = $ExcelRun.BeginInvoke() 64 | 65 | while ($ExcelJob.IsCompleted -contains $false) { Start-Sleep -Milliseconds 200 } 66 | 67 | $ExcelRun.EndInvoke($ExcelJob) 68 | 69 | $ExcelRun.Dispose() 70 | Remove-Variable -Name ExcelRun 71 | Remove-Variable -Name ExcelJob 72 | 73 | } 74 | 75 | if ($DebugEnvSize -eq 'Large') 76 | { 77 | Remove-Variable -Name SmaResources 78 | [System.GC]::Collect() 79 | Start-Sleep -Milliseconds 50 80 | } 81 | 82 | $ReportCounter ++ 83 | } 84 | 85 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Cleaning Variables to Release Memory.') 86 | 87 | if ($DebugEnvSize -eq 'Large') 88 | { 89 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Removing Cache Files.') 90 | $TargetFolder = Join-Path $DefaultPath 'ReportCache' 91 | Remove-Item -Path $TargetFolder -Recurse 92 | } 93 | else 94 | { 95 | Remove-Variable -Name SmaResources 96 | } 97 | 98 | [System.GC]::GetTotalMemory($true) | out-null 99 | Start-Sleep -Milliseconds 50 100 | } -------------------------------------------------------------------------------- /Modules/Public/InventoryModules/APIs/AdvisorScore.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Inventory for Azure Advisor Score 4 | 5 | .DESCRIPTION 6 | Excel Sheet Name: AdvisorScore 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/public/InventoryModules/APIs/AdvisorScore.ps1 10 | 11 | .COMPONENT 12 | This powershell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.1 16 | First Release Date: 25th Aug, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | 21 | <######## Default Parameters. Don't modify this ########> 22 | 23 | param($SCPath, $Sub, $Intag, $Resources, $Retirements, $Task, $File, $SmaResources, $TableStyle, $Unsupported) 24 | 25 | If ($Task -eq 'Processing') { 26 | 27 | $AdvisorScore = $Resources | Where-Object { $_.TYPE -eq 'Microsoft.Advisor/advisorScore' } 28 | 29 | if($AdvisorScore) 30 | { 31 | $tmp = foreach ($1 in $AdvisorScore) { 32 | if ($1.name -in ('Cost','OperationalExcellence','Performance','Security','HighAvailability','Advisor')) 33 | { 34 | $ResUCount = 1 35 | $SubId = $1.id.split('/')[2] 36 | $sub1 = $SUB | Where-Object { $_.id -eq $SubId } 37 | $data = $1.PROPERTIES 38 | $Series = $data.timeSeries | Where-Object {$_.aggregationLevel -eq 'Monthly'} 39 | 40 | $RefreshDate = $data.lastRefreshedScore.date 41 | $RefreshDate = [datetime]$RefreshDate 42 | $RefreshDate = $RefreshDate.ToString("yyyy-MM-dd") 43 | 44 | foreach ($Serie in $Series.scoreHistory) 45 | { 46 | $Date = $Serie.date 47 | $Date = [datetime]$Date 48 | $Date = $Date.ToString("yyyy-MM-dd") 49 | 50 | $obj = @{ 51 | 'ID' = $1.id; 52 | 'Subscription' = $sub1.Name; 53 | 'Category' = $1.Name; 54 | 'Latest Score (%)' = $data.lastRefreshedScore.score; 55 | 'Latest Refresh Score' = $RefreshDate; 56 | 'Score Date' = $Date; 57 | 'Score' = $Serie.score; 58 | 'Impacted Resources' = $Serie.impactedResourceCount; 59 | 'Consumption Units' = $Serie.consumptionUnits; 60 | 'Potential Score Increase' = $Serie.potentialScoreIncrease; 61 | 'Resource U' = $ResUCount 62 | } 63 | if ($ResUCount -eq 1) { $ResUCount = 0 } 64 | $obj 65 | } 66 | } 67 | } 68 | $tmp 69 | } 70 | } 71 | 72 | <######## Resource Excel Reporting Begins Here ########> 73 | 74 | Else { 75 | 76 | if ($SmaResources) { 77 | 78 | $TableName = ('AdvScTab_'+($SmaResources.'Resource U').count) 79 | $Style = New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat '0' 80 | 81 | $condtxt = @() 82 | 83 | $Exc = New-Object System.Collections.Generic.List[System.Object] 84 | $Exc.Add('Subscription') 85 | $Exc.Add('Category') 86 | $Exc.Add('Latest Score (%)') 87 | $Exc.Add('Latest Refresh Score') 88 | $Exc.Add('Score Date') 89 | $Exc.Add('Score') 90 | $Exc.Add('Impacted Resources') 91 | $Exc.Add('Consumption Units') 92 | $Exc.Add('Potential Score Increase') 93 | 94 | [PSCustomObject]$SmaResources | 95 | ForEach-Object { $_ } | Select-Object $Exc | 96 | Export-Excel -Path $File -WorksheetName 'AdvisorScore' -AutoSize -TableName $TableName -MaxAutoSizeRows 100 -TableStyle $tableStyle -ConditionalText $condtxt -Numberformat '0' -Style $Style 97 | 98 | } 99 | } -------------------------------------------------------------------------------- /Modules/Public/InventoryModules/APIs/ManagedIds.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Inventory for Azure Managed Identities 4 | 5 | .DESCRIPTION 6 | Excel Sheet Name: ManagedIdentities 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/APIs/ManagedIdentities.ps1 10 | 11 | .COMPONENT 12 | This powershell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 4.0.1 16 | First Release Date: 25th Aug, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | 21 | <######## Default Parameters. Don't modify this ########> 22 | 23 | param($SCPath, $Sub, $Intag, $Resources, $Retirements, $Task, $File, $SmaResources, $TableStyle, $Unsupported) 24 | 25 | If ($Task -eq 'Processing') { 26 | 27 | <######### Insert the resource extraction here ########> 28 | 29 | $ManagedIdentities = $Resources | Where-Object { $_.TYPE -eq 'Microsoft.ManagedIdentity/userAssignedIdentities' } 30 | 31 | <######### Insert the resource Process here ########> 32 | 33 | if($ManagedIdentities) 34 | { 35 | $tmp = foreach ($1 in $ManagedIdentities) { 36 | $ResUCount = 1 37 | $SubId = $1.id.split('/')[2] 38 | $sub1 = $SUB | Where-Object { $_.id -eq $SubId } 39 | $data = $1.PROPERTIES 40 | $Tags = if(![string]::IsNullOrEmpty($1.tags.psobject.properties)){$1.tags.psobject.properties}else{'0'} 41 | foreach ($Tag in $Tags) { 42 | $obj = @{ 43 | 'ID' = $1.id; 44 | 'Subscription' = $sub1.Name; 45 | 'Name' = $1.Name; 46 | 'Location' = $1.location; 47 | 'Principal ID' = $data.principalId; 48 | 'Client ID' = $data.clientId; 49 | 'Resource U' = $ResUCount; 50 | 'Tag Name' = [string]$Tag.Name; 51 | 'Tag Value' = [string]$Tag.Value 52 | } 53 | $obj 54 | if ($ResUCount -eq 1) { $ResUCount = 0 } 55 | } 56 | } 57 | $tmp 58 | } 59 | } 60 | 61 | <######## Resource Excel Reporting Begins Here ########> 62 | 63 | Else { 64 | <######## $SmaResources.(RESOURCE FILE NAME) ##########> 65 | 66 | if ($SmaResources) { 67 | 68 | $TableName = ('ManIdTable_'+($SmaResources.'Resource U').count) 69 | $Style = New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat '0' 70 | 71 | $Exc = New-Object System.Collections.Generic.List[System.Object] 72 | $Exc.Add('Subscription') 73 | $Exc.Add('Name') 74 | $Exc.Add('Location') 75 | $Exc.Add('Principal ID') 76 | $Exc.Add('Client ID') 77 | if($InTag) 78 | { 79 | $Exc.Add('Tag Name') 80 | $Exc.Add('Tag Value') 81 | } 82 | 83 | [PSCustomObject]$SmaResources | 84 | ForEach-Object { $_ } | Select-Object $Exc | 85 | Export-Excel -Path $File -WorksheetName 'Managed Identity' -AutoSize -TableName $TableName -MaxAutoSizeRows 100 -TableStyle $tableStyle -Numberformat '0' -Style $Style 86 | 87 | } 88 | } -------------------------------------------------------------------------------- /Modules/Public/InventoryModules/APIs/ReservationRecom.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Inventory for Azure Reservation Recommendations 4 | 5 | .DESCRIPTION 6 | Excel Sheet Name: Reservation Advisor 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/APIs/ReservationRecom.ps1 10 | 11 | .COMPONENT 12 | This powershell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 4.0.1 16 | First Release Date: 25th Aug, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | 21 | <######## Default Parameters. Don't modify this ########> 22 | 23 | param($SCPath, $Sub, $Intag, $Resources, $Retirements, $Task, $File, $SmaResources, $TableStyle, $Unsupported) 24 | 25 | If ($Task -eq 'Processing') { 26 | 27 | <######### Insert the resource extraction here ########> 28 | 29 | $Reserv = $Resources | Where-Object { $_.TYPE -eq 'Microsoft.Consumption/reservationRecommendations' } 30 | 31 | <######### Insert the resource Process here ########> 32 | 33 | if($Reserv) 34 | { 35 | $tmp = foreach ($1 in $Reserv) { 36 | $ResUCount = 1 37 | $SubId = $1.id.split('/')[2] 38 | $sub1 = $SUB | Where-Object { $_.id -eq $SubId } 39 | $data = $1.PROPERTIES 40 | $obj = @{ 41 | 'ID' = $1.id; 42 | 'Subscription' = $sub1.Name; 43 | 'Current SKU' = $1.SKU; 44 | 'Location' = $1.location; 45 | 'Resource Type' = $data.resourceType; 46 | 'Instance Flexibility Group' = $data.instanceFlexibilityGroup; 47 | 'Recommended Size' = $data.normalizedSize; 48 | 'Recommended Number of Reservations'= $data.recommendedQuantity; 49 | 'Instance Flexibility Ratio' = $data.instanceFlexibilityRatio; 50 | 'Quantity Normalized' = $data.recommendedQuantityNormalized; 51 | 'Cost With No Reserved Instance' = $data.costWithNoReservedInstances; 52 | 'Cost With Reserved Instance' = $data.totalCostWithReservedInstances; 53 | 'Net Savings' = $data.netSavings; 54 | 'Reservation Term' = $data.term; 55 | 'Scope' = $data.scope; 56 | 'Resource U' = $ResUCount 57 | } 58 | $obj 59 | if ($ResUCount -eq 1) { $ResUCount = 0 } 60 | } 61 | $tmp 62 | } 63 | } 64 | 65 | <######## Resource Excel Reporting Begins Here ########> 66 | 67 | Else { 68 | <######## $SmaResources.(RESOURCE FILE NAME) ##########> 69 | 70 | if ($SmaResources) { 71 | 72 | $TableName = ('ReservRecTable_'+($SmaResources.'Resource U').count) 73 | 74 | $Style = @() 75 | $Style += New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat '0' -Range A:I 76 | $Style += New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat '#,##0.00' -Range J:L 77 | $Style += New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat '0' -Range M:N 78 | 79 | $Exc = New-Object System.Collections.Generic.List[System.Object] 80 | $Exc.Add('Subscription') 81 | $Exc.Add('Current SKU') 82 | $Exc.Add('Location') 83 | $Exc.Add('Resource Type') 84 | $Exc.Add('Instance Flexibility Group') 85 | $Exc.Add('Recommended Size') 86 | $Exc.Add('Recommended Number of Reservations') 87 | $Exc.Add('Instance Flexibility Ratio') 88 | $Exc.Add('Quantity Normalized') 89 | $Exc.Add('Cost With No Reserved Instance') 90 | $Exc.Add('Cost With Reserved Instance') 91 | $Exc.Add('Net Savings') 92 | $Exc.Add('Reservation Term') 93 | $Exc.Add('Scope') 94 | 95 | [PSCustomObject]$SmaResources | 96 | ForEach-Object { $_ } | Select-Object $Exc | 97 | Export-Excel -Path $File -WorksheetName 'Reservation Advisor' -AutoSize -TableName $TableName -MaxAutoSizeRows 100 -TableStyle $tableStyle -Style $Style 98 | 99 | } 100 | } -------------------------------------------------------------------------------- /Modules/Public/InventoryModules/APIs/SupportTickets.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Inventory for Azure Support Tickets 4 | 5 | .DESCRIPTION 6 | Excel Sheet Name: SupportTickets 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/APIs/SupportTickets.ps1 10 | 11 | .COMPONENT 12 | This powershell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 4.0.1 16 | First Release Date: 25th Aug, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | 21 | <######## Default Parameters. Don't modify this ########> 22 | 23 | param($SCPath, $Sub, $Intag, $Resources, $Retirements, $Task, $File, $SmaResources, $TableStyle, $Unsupported) 24 | 25 | If ($Task -eq 'Processing') { 26 | 27 | <######### Insert the resource extraction here ########> 28 | 29 | $Tickets = $Resources | Where-Object { $_.TYPE -eq 'Microsoft.Support/supportTickets' } 30 | 31 | <######### Insert the resource Process here ########> 32 | 33 | if($Tickets) 34 | { 35 | $tmp = foreach ($1 in $Tickets) { 36 | $ResUCount = 1 37 | $data = $1.PROPERTIES 38 | 39 | $timecreated = $data.createdDate 40 | $timecreated = [datetime]$timecreated 41 | $timecreated = $timecreated.ToString("yyyy-MM-dd HH:mm") 42 | 43 | $ProblemDate = $data.problemStartTime 44 | $ProblemDate = [datetime]$ProblemDate 45 | $ProblemDate = $ProblemDate.ToString("yyyy-MM-dd HH:mm") 46 | 47 | $ModDate = $data.modifiedDate 48 | $ModDate = [datetime]$ModDate 49 | $ModDate = $ModDate.ToString("yyyy-MM-dd HH:mm") 50 | 51 | $obj = @{ 52 | 'ID' = $1.id; 53 | 'Support Ticket' = $data.supportTicketId; 54 | 'Title' = $data.title; 55 | 'Support Plan' = $data.supportPlanType; 56 | 'Service' = $data.serviceDisplayName; 57 | 'Current Severity' = $data.severity; 58 | 'Status' = $data.status; 59 | 'Creation Date' = $timecreated; 60 | '24/7 Response' = $data.require24X7Response; 61 | 'Ticket SLA (minutes)' = $data.serviceLevelAgreement.slaMinutes; 62 | 'Problem Start Date' = $ProblemDate; 63 | 'Last Modified Date' = $ModDate; 64 | 'Support Engineer' = $data.supportEngineer.emailAddress; 65 | 'Ticket Contact Name' = ($data.contactDetails.firstName + ' ' + $data.contactDetails.lastName); 66 | 'Ticket Contact Email' = $data.contactDetails.primaryEmailAddress; 67 | 'Ticket Contact Country' = $data.contactDetails.country; 68 | 'Resource U' = $ResUCount 69 | } 70 | $obj 71 | } 72 | $tmp 73 | } 74 | } 75 | 76 | <######## Resource Excel Reporting Begins Here ########> 77 | 78 | Else { 79 | <######## $SmaResources.(RESOURCE FILE NAME) ##########> 80 | 81 | if ($SmaResources) { 82 | 83 | $TableName = ('TicketsTable_'+($SmaResources.'Resource U').count) 84 | $Style = New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat '0' 85 | 86 | $cond = @() 87 | $cond += New-ConditionalText Open -Range F:F 88 | 89 | $Exc = New-Object System.Collections.Generic.List[System.Object] 90 | $Exc.Add('Support Ticket') 91 | $Exc.Add('Title') 92 | $Exc.Add('Support Plan') 93 | $Exc.Add('Service') 94 | $Exc.Add('Current Severity') 95 | $Exc.Add('Status') 96 | $Exc.Add('Creation Date') 97 | $Exc.Add('24/7 Response') 98 | $Exc.Add('Ticket SLA (minutes)') 99 | $Exc.Add('Support Engineer') 100 | $Exc.Add('Problem Start Date') 101 | $Exc.Add('Last Modified Date') 102 | $Exc.Add('Ticket Contact Name') 103 | $Exc.Add('Ticket Contact Email') 104 | $Exc.Add('Ticket Contact Country') 105 | 106 | [PSCustomObject]$SmaResources | 107 | ForEach-Object { $_ } | Select-Object $Exc | 108 | Export-Excel -Path $File -WorksheetName 'Support Tickets' -TableName $TableName -MaxAutoSizeRows 100 -TableStyle $tableStyle -ConditionalText $cond -Style $Style 109 | 110 | } 111 | } -------------------------------------------------------------------------------- /Modules/Public/PublicFunctions/Diagram/Set-ARIDiagramFile.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | File Module for Draw.io Diagram 4 | 5 | .DESCRIPTION 6 | This module is used for setting and managing files in the Draw.io Diagram. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Public/PublicFunctions/Diagram/Set-ARIDiagramFile.ps1 10 | 11 | .COMPONENT 12 | This PowerShell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Set-ARIDiagramFile { 21 | Param ($XMLFiles, $DDFile, $LogFile) 22 | try 23 | { 24 | ('DrawIOFileJob - '+(get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - Merging XML Files ') | Out-File -FilePath $LogFile -Append 25 | foreach($File in $XMLFiles) 26 | { 27 | $oldxml = New-Object XML 28 | $oldxml.Load($File) 29 | 30 | $newxml = New-Object XML 31 | $newxml.Load($DDFile) 32 | 33 | $oldxml.DocumentElement.InsertAfter($oldxml.ImportNode($newxml.SelectSingleNode('mxfile'), $true), $afternode) 34 | 35 | $oldxml.Save($DDFile) 36 | 37 | Remove-Item -Path $File 38 | 39 | Start-Sleep -Milliseconds 200 40 | } 41 | } 42 | catch 43 | { 44 | ('DrawIOFileJob - '+(get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - Error: ' + $_.Exception.Message) | Out-File -FilePath $LogFile -Append 45 | } 46 | } -------------------------------------------------------------------------------- /Modules/Public/PublicFunctions/Jobs/Start-ARIAdvisoryJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Public Advisory Job Module 4 | 5 | .DESCRIPTION 6 | This script creates the job to process the Advisory data. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Public/PublicFunctions/Jobs/Start-ARIAdvisoryJob.ps1 10 | 11 | .COMPONENT 12 | This powershell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Start-ARIAdvisoryJob { 21 | param($Advisories) 22 | 23 | $tmp = foreach ($1 in $Advisories) 24 | { 25 | $data = $1.PROPERTIES 26 | $Savings = if([string]::IsNullOrEmpty($data.extendedProperties.annualSavingsAmount)){0}Else{$data.extendedProperties.annualSavingsAmount} 27 | $SavingsCurrency = if([string]::IsNullOrEmpty($data.extendedProperties.savingsCurrency)){'USD'}Else{$data.extendedProperties.savingsCurrency} 28 | $obj = @{ 29 | 'ResourceGroup' = $1.RESOURCEGROUP; 30 | 'Affected Resource Type' = $data.impactedField; 31 | 'Name' = $data.impactedValue; 32 | 'Category' = $data.category; 33 | 'Impact' = $data.impact; 34 | #'Score' = $data.extendedproperties.score; 35 | 'Problem' = $data.shortDescription.problem; 36 | 'Savings Currency' = $SavingsCurrency; 37 | 'Annual Savings' = "=$Savings"; 38 | 'Savings Region' = $data.extendedProperties.location; 39 | 'Current SKU' = $data.extendedProperties.currentSku; 40 | 'Target SKU' = $data.extendedProperties.targetSku 41 | } 42 | $obj 43 | } 44 | $tmp 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Modules/Public/PublicFunctions/Jobs/Start-ARIPolicyJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Start Policy Job Module 4 | 5 | .DESCRIPTION 6 | This script processes and creates the Policy sheet based on advisor resources. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Public/PublicFunctions/Jobs/Start-ARIPolicyJob.ps1 10 | 11 | .COMPONENT 12 | This powershell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Start-ARIPolicyJob { 21 | param($Subscriptions, $PolicySetDef, $PolicyAssign, $PolicyDef) 22 | 23 | $poltmp = $PolicyDef | Select-Object -Property id,properties -Unique 24 | 25 | $tmp = foreach ($1 in $PolicyAssign.policyAssignments) 26 | { 27 | if(![string]::IsNullOrEmpty($1.policySetDefinitionId)) 28 | { 29 | $TempPolDef = foreach ($PolDe in $PolicySetDef) 30 | { 31 | if ($PolDe.id -eq $1.policySetDefinitionId) 32 | { 33 | $PolDe.properties.displayName 34 | } 35 | } 36 | $Initiative = if($TempPolDef.count -gt 1){$TempPolDef[0]}else{$TempPolDef} 37 | $InitNonCompRes = $1.results.nonCompliantResources 38 | $InitNonCompPol = $1.results.nonCompliantPolicies 39 | } 40 | else 41 | { 42 | $Initiative = '' 43 | $InitNonCompRes = '' 44 | $InitNonCompPol = '' 45 | } 46 | 47 | foreach ($2 in $1.policyDefinitions) 48 | { 49 | $Pol = (($poltmp | Where-Object {$_.id -eq $2.policyDefinitionId}).properties) 50 | if(![string]::IsNullOrEmpty($Pol)) 51 | { 52 | $PolResUnkown = ($2.results.resourceDetails | Where-Object {$_.complianceState -eq 'unknown'} | Select-Object -ExpandProperty Count) 53 | $PolResUnkown = if (![string]::IsNullOrEmpty($PolResUnkown)){$PolResUnkown}else{'0'} 54 | $PolResCompl = ($2.results.resourceDetails | Where-Object {$_.complianceState -eq 'compliant'} | Select-Object -ExpandProperty Count) 55 | $PolResCompl = if (![string]::IsNullOrEmpty($PolResCompl)){$PolResCompl}else{'0'} 56 | $PolResNonCompl = ($2.results.resourceDetails | Where-Object {$_.complianceState -eq 'noncompliant'} | Select-Object -ExpandProperty Count) 57 | $PolResNonCompl = if (![string]::IsNullOrEmpty($PolResNonCompl)){$PolResNonCompl}else{'0'} 58 | $PolResExemp = ($2.results.resourceDetails | Where-Object {$_.complianceState -eq 'exempt'} | Select-Object -ExpandProperty Count) 59 | $PolResExemp = if (![string]::IsNullOrEmpty($PolResExemp)){$PolResExemp}else{'0'} 60 | 61 | $obj = @{ 62 | 'Initiative' = $Initiative; 63 | 'Initiative Non Compliance Resources' = $InitNonCompRes; 64 | 'Initiative Non Compliance Policies' = $InitNonCompPol; 65 | 'Policy' = $Pol.displayName; 66 | 'Policy Type' = $Pol.policyType; 67 | 'Effect' = $2.effect; 68 | 'Compliance Resources' = $PolResCompl; 69 | 'Non Compliance Resources' = $PolResNonCompl; 70 | 'Unknown Resources' = $PolResUnkown; 71 | 'Exempt Resources' = $PolResExemp 72 | 'Policy Mode' = $Pol.mode; 73 | 'Policy Version' = $Pol.version; 74 | 'Policy Deprecated' = $Pol.metadata.deprecated; 75 | 'Policy Category' = $Pol.metadata.category 76 | } 77 | $obj 78 | } 79 | } 80 | } 81 | $tmp 82 | } -------------------------------------------------------------------------------- /Modules/Public/PublicFunctions/Jobs/Start-ARISecCenterJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Start Security Center Job Module 4 | 5 | .DESCRIPTION 6 | This script processes and creates the Security Center sheet based on security resources. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Public/PublicFunctions/Jobs/Start-ARISecCenterJob.ps1 10 | 11 | .COMPONENT 12 | This powershell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Start-ARISecCenterJob { 21 | param($Subscriptions,$Security) 22 | $obj = '' 23 | $tmp = @() 24 | 25 | foreach ($1 in $Security) { 26 | $data = $1.PROPERTIES 27 | 28 | $sub1 = $Subscriptions | Where-Object { $_.id -eq $1.properties.resourceDetails.Id.Split("/")[2] } 29 | 30 | $obj = @{ 31 | 'Subscription' = $sub1.Name; 32 | 'Resource Group' = $1.RESOURCEGROUP; 33 | 'Resource Type' = $data.resourceDetails.Id.Split("/")[7]; 34 | 'Resource Name' = $data.resourceDetails.Id.Split("/")[8]; 35 | 'Categories' = [string]$data.metadata.categories; 36 | 'Control' = $data.displayName; 37 | 'Severity' = $data.metadata.severity; 38 | 'Status' = $data.status.code; 39 | 'Remediation' = $data.metadata.remediationDescription; 40 | 'Remediation Effort' = $data.metadata.implementationEffort; 41 | 'User Impact' = $data.metadata.userImpact; 42 | 'Threats' = [string]$data.metadata.threats 43 | } 44 | $tmp += $obj 45 | } 46 | $tmp 47 | } -------------------------------------------------------------------------------- /Modules/Public/PublicFunctions/Jobs/Wait-ARIJob.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Wait for ARI Jobs to Complete 4 | 5 | .DESCRIPTION 6 | This script waits for the completion of specified ARI jobs. 7 | 8 | .Link 9 | https://github.com/microsoft/ARI/Modules/Public/PublicFunctions/Jobs/Wait-ARIJob.ps1 10 | 11 | .COMPONENT 12 | This powershell Module is part of Azure Resource Inventory (ARI) 13 | 14 | .NOTES 15 | Version: 3.6.0 16 | First Release Date: 15th Oct, 2024 17 | Authors: Claudio Merola 18 | 19 | #> 20 | function Wait-ARIJob { 21 | Param($JobNames, $JobType, $LoopTime) 22 | 23 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Jobs Collector.') 24 | 25 | $c = 0 26 | 27 | while (get-job -Name $JobNames | Where-Object { $_.State -eq 'Running' }) { 28 | $jb = get-job -Name $JobNames 29 | $c = (((($jb.count - ($jb | Where-Object { $_.State -eq 'Running' }).Count)) / $jb.Count) * 100) 30 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+"$JobType Jobs Still Running: "+[string]($jb | Where-Object { $_.State -eq 'Running' }).count) 31 | $c = [math]::Round($c) 32 | Write-Progress -Id 1 -activity "Processing $JobType Jobs" -Status "$c% Complete." -PercentComplete $c 33 | Start-Sleep -Seconds $LoopTime 34 | } 35 | Write-Progress -Id 1 -activity "Processing $JobType Jobs" -Status "100% Complete." -Completed 36 | 37 | Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Jobs Complete.') 38 | } -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | 4 | 5 |
6 | Microsoft Logo 7 |

Microsoft Security Reporting

8 |
9 | 10 | ## 🛡️ Security Commitment 11 | 12 | Microsoft takes the security of our software products and services seriously. This commitment extends to all source code repositories managed through our GitHub organizations, including: 13 | 14 | - [Microsoft](https://github.com/Microsoft) 15 | - [Azure](https://github.com/Azure) 16 | - [DotNet](https://github.com/dotnet) 17 | - [AspNet](https://github.com/aspnet) 18 | - [Xamarin](https://github.com/xamarin) 19 | - [Other Microsoft GitHub organizations](https://opensource.microsoft.com/) 20 | 21 | If you believe you have discovered a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us following the guidelines below. 22 | 23 | ## 🔐 Reporting Security Issues 24 | 25 | > **Important:** Please do not report security vulnerabilities through public GitHub issues. 26 | 27 | ### Reporting Process 28 | 29 | 1. **Submit your report** to the Microsoft Security Response Center (MSRC): 30 | - Preferred method: [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report) 31 | - Alternative method (if you prefer not to log in): Send email to [secure@microsoft.com](mailto:secure@microsoft.com) 32 | 33 | 2. **For encrypted communication**: Consider encrypting your message with our PGP key, available from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 34 | 35 | 3. **Response timeline**: You should receive a response within 24 hours. If you don't, please send a follow-up email to ensure we received your original message. 36 | 37 | 4. **Additional information**: For more details on the reporting process, visit [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 38 | 39 | ### Information to Include 40 | 41 | To help us quickly assess the issue, please include as much of the following information as possible: 42 | 43 | | Information Type | Details to Provide | 44 | |-----------------|-------------------| 45 | | Issue type | Buffer overflow, SQL injection, cross-site scripting, etc. | 46 | | Source files | Full paths of source file(s) related to the issue | 47 | | Location | Tag/branch/commit or direct URL to affected code | 48 | | Configuration | Any special configuration required to reproduce the issue | 49 | | Reproduction steps | Step-by-step instructions to reproduce the issue | 50 | | Proof of concept | Exploit code or demonstration (if possible) | 51 | | Impact assessment | How an attacker might exploit the issue and potential impact | 52 | 53 | Providing thorough information helps us evaluate your report more efficiently. 54 | 55 | > **Bug Bounty Programs**: If you're reporting for a bug bounty, more complete reports can contribute to a higher bounty award. For details about our active programs, visit the [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page. 56 | 57 | ## 🌐 Communication 58 | 59 | We prefer all communications to be in English. 60 | 61 | ## 📜 Disclosure Policy 62 | 63 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 64 | 65 | 66 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Support for Azure Resource Inventory 2 | 3 |
4 | Microsoft Logo 5 |

6 |

7 | GitHub Issues 8 | GitHub Pull Requests 9 |

10 |
11 | 12 | ## 📋 Filing Issues and Getting Help 13 | 14 | This project uses GitHub Issues to track bugs, feature requests, and questions. Before creating a new issue, please follow these steps: 15 | 16 | 1. **Search existing issues**: Check the [existing issues](https://github.com/microsoft/ARI/issues) to see if your problem or request has already been reported. 17 | 18 | 2. **Create a detailed issue**: If no existing issue addresses your needs, create a [new issue](https://github.com/microsoft/ARI/issues/new) with: 19 | - A clear, descriptive title 20 | - Detailed steps to reproduce bugs or clear descriptions of feature requests 21 | - Version information (PowerShell version, module version, OS) 22 | - Screenshots or logs when applicable 23 | 24 | 3. **Use issue templates**: If available, use the appropriate issue template to ensure you provide all the necessary information. 25 | 26 | ## 🔍 Types of Issues 27 | 28 | | Issue Type | Description | Template | 29 | |------------|-------------|----------| 30 | | Bug Report | Report a problem with existing functionality | Bug Report | 31 | | Feature Request | Suggest a new feature or enhancement | Feature Request | 32 | | Documentation | Report issues with documentation | Documentation | 33 | | Question | Ask a question about usage | Question | 34 | 35 | ## 🛡️ Microsoft Support Policy 36 | 37 | Official support for this project is limited to the GitHub issues system as described above. 38 | 39 | > **Note**: Azure Resource Inventory is an open-source project maintained by Microsoft. While we strive to address issues in a timely manner, response times may vary based on priority and maintainer availability. 40 | 41 | ## 🔄 Issue Lifecycle 42 | 43 | 1. **New**: Issue has been submitted but not yet reviewed 44 | 2. **Triaged**: Issue has been reviewed and accepted for consideration 45 | 3. **In Progress**: Work has begun on addressing the issue 46 | 4. **Resolved**: The issue has been addressed and is ready for closure 47 | 48 | ## 💬 Community Support 49 | 50 | We encourage community participation through: 51 | 52 | - Discussions in issue threads 53 | - Contributing fixes or improvements via pull requests 54 | - Sharing workarounds and solutions 55 | 56 | ## 📚 Additional Resources 57 | 58 | - [Project README](README.md) 59 | - [Contributing Guidelines](CONTRIBUTING.md) 60 | - [Code of Conduct](CODE_OF_CONDUCT.md) 61 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Azure Resource Inventory Documentation 2 | 3 | This directory contains the source files for the Azure Resource Inventory (ARI) documentation site. 4 | 5 | ## Overview 6 | 7 | The documentation is built using [MkDocs](https://www.mkdocs.org/) with the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme. The documentation is automatically built and deployed to GitHub Pages using GitHub Actions when changes are pushed to the main branch. 8 | 9 | ## Directory Structure 10 | 11 | - `docs/` - Contains all documentation source files 12 | - `index.md` - Home page of the documentation 13 | - `getting-started/` - Installation and quick start guides 14 | - `user-guide/` - Usage guides and reference 15 | - `features/` - Documentation for specific features 16 | - `advanced/` - Advanced topics and configuration 17 | - `development/` - Development guides and contributing 18 | - `about/` - License, authors, and related information 19 | 20 | ## Testing Documentation Locally 21 | 22 | To test the documentation locally: 23 | 24 | 1. Create a virtual environment: 25 | ```bash 26 | python -m venv docs-venv 27 | source docs-venv/bin/activate # On Windows: docs-venv\Scripts\activate 28 | ``` 29 | 30 | 2. Install the dependencies: 31 | ```bash 32 | pip install -r requirements.txt 33 | ``` 34 | 35 | 3. Run MkDocs: 36 | ```bash 37 | mkdocs serve 38 | ``` 39 | 40 | 4. Open your browser and go to `http://127.0.0.1:8000` 41 | 42 | Alternatively, run the included script: 43 | ```bash 44 | ./test-docs.sh 45 | ``` 46 | 47 | ## GitHub Actions Workflow 48 | 49 | The documentation is automatically built and deployed to GitHub Pages using the GitHub Actions workflow defined in `.github/workflows/documentation.yml`. 50 | 51 | To test the workflow locally: 52 | 53 | 1. Install [act](https://github.com/nektos/act) 54 | 2. Run the included script: 55 | ```bash 56 | ./test-workflow.sh 57 | ``` 58 | 59 | ## Contributing to Documentation 60 | 61 | When adding new content: 62 | 63 | 1. Create Markdown files in the appropriate directories 64 | 2. Update the navigation in the `mkdocs.yml` file 65 | 3. Test locally to ensure everything works correctly 66 | 4. Submit a pull request 67 | 68 | ## Formatting Guidelines 69 | 70 | - Use Markdown formatting for all documentation 71 | - Follow a consistent structure with headers (# for main title, ## for sections, etc.) 72 | - Use code blocks with syntax highlighting for code examples (```powershell) 73 | - Use relative links to reference other documentation pages 74 | - Add images to the `images/` directory and reference them with relative paths 75 | 76 | ## Useful Commands 77 | 78 | - `mkdocs build` - Build the documentation site 79 | - `mkdocs serve` - Start the live-reloading docs server 80 | - `mkdocs gh-deploy` - Deploy the documentation to GitHub Pages (manual deployment) -------------------------------------------------------------------------------- /docs/about/authors.md: -------------------------------------------------------------------------------- 1 | # Authors & Acknowledgments 2 | 3 | Azure Resource Inventory was created by Microsoft engineers to help customers document and manage their Azure environments. This page acknowledges the contributors and maintainers of the project. 4 | 5 | ## Original Authors 6 | 7 | Azure Resource Inventory was originally created by: 8 | 9 | - **Claudio Merola** - *Initial work and core functionality* 10 | 11 | ## Current Maintainers 12 | 13 | The project is currently maintained by: 14 | 15 | - Microsoft Customer Experience Engineering team 16 | 17 | ## Contributors 18 | 19 | Many people have contributed to Azure Resource Inventory over time. Contributors include (alphabetically): 20 | 21 | - Alexandre Verkinderen 22 | - Claudio Merola 23 | - Giselle Lisboa 24 | - Itai Yankelevsky 25 | - Jeferson Machado dos Santos 26 | - JP Sarmiento 27 | - Lucas Hattori Costa 28 | - Peter Szabo 29 | - Thiago Almeida 30 | 31 | ## Special Thanks 32 | 33 | Special thanks go to: 34 | 35 | - The Azure Adoption Framework team for guidance and best practices integration 36 | - The Azure Cloud Solution Architects who provided feedback and use cases 37 | - All users who have reported issues, requested features, and helped test the tool 38 | 39 | ## How to Get Involved 40 | 41 | If you'd like to contribute to Azure Resource Inventory, please read our [Contributing Guide](../development/contributing.md) for information on how to get started. 42 | 43 | ## Report Issues 44 | 45 | Found a bug or have a feature request? Please report it in the [GitHub repository issues page](https://github.com/microsoft/ARI/issues). 46 | 47 | ## Community 48 | 49 | Azure Resource Inventory has been used by many organizations across the world to document and inventory their Azure environments. We're grateful for the community adoption and feedback that continues to improve the tool. 50 | 51 | ## Further Information 52 | 53 | For more information about the project, please visit the [GitHub repository](https://github.com/microsoft/ARI). 54 | 55 | --- 56 | 57 | *Note: This list may not be complete. If you've contributed to the project and your name is not listed, please feel free to create a pull request to add yourself.* -------------------------------------------------------------------------------- /docs/about/changelog.md: -------------------------------------------------------------------------------- 1 | # Version History 2 | 3 | This page documents the version history and key changes for Azure Resource Inventory. 4 | 5 | ## Version 3.6.4 (Current) 6 | 7 | ### Improvements 8 | - Updated module to support the latest Azure resource providers 9 | - Enhanced performance for large environments 10 | - Improved error handling and messaging 11 | - Updated Azure Security Center integration with Microsoft Defender for Cloud 12 | 13 | ### Bug Fixes 14 | - Fixed issue with some resource types not being properly collected 15 | - Corrected formatting problems in Excel output 16 | - Addressed errors when collecting VM extension details 17 | - Fixed diagram generation for complex network topologies 18 | 19 | ## Version 3.6.0 20 | 21 | ### New Features 22 | - Added `-IncludeCosts` parameter for cost data collection 23 | - Improved Azure Advisor integration 24 | - Enhanced network topology diagrams with more details 25 | - Added support for additional resource types 26 | 27 | ### Improvements 28 | - Optimized performance for large subscriptions 29 | - Reduced memory usage during report generation 30 | - Enhanced Excel report formatting and readability 31 | - Better error handling and reporting 32 | 33 | ## Version 3.5.0 34 | 35 | ### New Features 36 | - Added support for Azure Arc servers 37 | - Enhanced diagram generation with organization view 38 | - Added support for Flex databases (MySQL, PostgreSQL) 39 | - Improved tag collection and reporting 40 | 41 | ### Improvements 42 | - Faster data collection using Resource Graph 43 | - Better formatting in Excel reports 44 | - Enhanced error handling 45 | - Added more details to virtual machine reporting 46 | 47 | ## Version 3.0.0 48 | 49 | ### Major Changes 50 | - Complete rewrite as a PowerShell module 51 | - Published to PowerShell Gallery for easier installation 52 | - Added automation capabilities 53 | - Enhanced reporting format 54 | 55 | ### New Features 56 | - Diagram generation for network topology 57 | - Security Center integration 58 | - Azure Policy integration 59 | - Support for resource tags 60 | 61 | ## Version 2.0.0 62 | 63 | ### Major Changes 64 | - Expanded resource type coverage 65 | - Improved Excel report format 66 | - Added support for multiple subscriptions 67 | 68 | ### New Features 69 | - Subscription filtering 70 | - Resource group filtering 71 | - Performance improvements 72 | - Enhanced error handling 73 | 74 | ## Version 1.0.0 75 | 76 | ### Initial Release 77 | - Basic inventory capabilities 78 | - Support for core Azure resources 79 | - Excel report generation 80 | - Simple filtering options 81 | 82 | ## Pre-Release History 83 | 84 | Early development versions of ARI were used internally at Microsoft before the public release. 85 | 86 | ## Reporting Issues 87 | 88 | If you encounter problems with any version of ARI, please report them on the [GitHub Issues page](https://github.com/microsoft/ARI/issues). 89 | 90 | ## Contributing 91 | 92 | Interested in contributing to future versions? See our [Contributing Guide](../development/contributing.md). -------------------------------------------------------------------------------- /docs/about/license.md: -------------------------------------------------------------------------------- 1 | # License Information 2 | 3 | Azure Resource Inventory is licensed under the MIT License. 4 | 5 | ## MIT License 6 | 7 | MIT License 8 | 9 | Copyright (c) Microsoft Corporation. 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 27 | SOFTWARE. 28 | 29 | ## Using Azure Resource Inventory 30 | 31 | Azure Resource Inventory is a tool provided by Microsoft that can be used to generate Excel-based reports about your Azure resources. It is provided as-is, without warranty, and is not an officially supported Microsoft product. 32 | 33 | ## Third-Party Software 34 | 35 | Azure Resource Inventory uses the following third-party software, which have their own licenses: 36 | 37 | ### PowerShell Modules 38 | 39 | - **ImportExcel**: Used for Excel report generation 40 | - **Az PowerShell Modules**: Used to interact with Azure services 41 | 42 | ### Export Formats 43 | 44 | - **Draw.io**: The diagrams are generated in Draw.io format, which can be opened with the Draw.io application or website. 45 | 46 | ## Contributing 47 | 48 | By contributing to Azure Resource Inventory, you agree that your contributions will be licensed under the project's MIT License. 49 | 50 | ## No Additional Restrictions 51 | 52 | The MIT License is a permissive open-source license that allows for reuse, modification, and distribution with minimal restrictions. No additional restrictions are added beyond what is in the standard MIT License. 53 | 54 | ## Full License Text 55 | 56 | The full license text can be found in the [LICENSE](https://github.com/microsoft/ARI/blob/main/LICENSE) file in the project repository. 57 | 58 | ## Questions 59 | 60 | If you have any questions about the license or how you can use Azure Resource Inventory, please refer to the [Microsoft Open Source](https://opensource.microsoft.com/) website or create an issue in the [GitHub repository](https://github.com/microsoft/ARI/issues). -------------------------------------------------------------------------------- /docs/advanced/automation.md: -------------------------------------------------------------------------------- 1 | # Automation Guide 2 | 3 | Azure Resource Inventory can be set up to run automatically using Azure Automation Accounts. This guide will walk you through the process of setting up an automated inventory system. 4 | 5 | ## Prerequisites 6 | 7 | To run ARI as an Automation Account, you need: 8 | 9 | 1. An Azure Automation Account 10 | 2. An Azure Storage Account 11 | 3. A Blob Container inside the Storage Account 12 | 13 | ## Setup Process 14 | 15 | ### Step 1: Create an Automation Account 16 | 17 | If you don't already have an Automation Account, create one in the Azure Portal. 18 | 19 | ### Step 2: Enable System-Assigned Identity 20 | 21 | 1. In your Automation Account, navigate to the **Identity** section 22 | 2. Enable the **System Assigned** identity 23 | 24 |
25 | 26 |
27 | 28 | ### Step 3: Grant Required Permissions 29 | 30 | The Automation Account's identity needs the following permissions: 31 | 32 | #### Reader Access to Management Group 33 | 34 | Grant the Automation Account's identity Reader access to your Management Group or subscriptions to enable resource inventory: 35 | 36 |
37 | 38 |
39 | 40 | #### Storage Blob Data Contributor 41 | 42 | Grant the Automation Account's identity the "Storage Blob Data Contributor" role on your storage account: 43 | 44 |
45 | 46 |
47 | 48 | ### Step 4: Configure Runtime Environment 49 | 50 | 1. In your Automation Account, go to **Runtime environments** 51 | 2. Switch to the new Runtime Environment Experience 52 | 53 |
54 | 55 |
56 | 57 | 3. Create a new Runtime Environment 58 | 59 |
60 | 61 |
62 | 63 | 4. Use PowerShell version **7.4** (recommended and tested) 64 | 65 | ### Step 5: Import Required Modules 66 | 67 | In the "Packages" pane of your Runtime Environment, import the following modules from the gallery: 68 | 69 |
70 | 71 |
72 | 73 | 1. AzureResourceInventory 74 | 2. ImportExcel 75 | 3. Az.ResourceGraph 76 | 4. Az.Accounts 77 | 5. Az.Storage 78 | 6. Az.Compute 79 | 7. Az.CostManagement (only if using the `-IncludeCosts` parameter) 80 | 81 | ### Step 6: Create a PowerShell Runbook 82 | 83 | 1. In your Automation Account, create a new PowerShell Runbook 84 | 85 |
86 | 87 |
88 | 89 | 2. Add the Invoke-ARI command to the runbook: 90 | 91 |
92 | 93 |
94 | 95 | 3. Make sure to select the Runtime Environment you created earlier 96 | 97 | ### Step 7: Configure the ARI Command 98 | 99 | Add the Invoke-ARI command with the required parameters: 100 | 101 | ```powershell 102 | Invoke-ARI -TenantID "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -Automation -StorageAccount "mystorageaccount" -StorageContainer "reports" 103 | ``` 104 | 105 | Required parameters: 106 | - **TenantID**: Your Azure Tenant ID 107 | - **Automation**: Indicates this is running in an Automation Account 108 | - **StorageAccount**: The storage account where reports will be saved 109 | - **StorageContainer**: The container within the storage account for reports 110 | 111 | ### Step 8: Schedule the Runbook 112 | 113 | 1. Save and publish your runbook 114 | 2. Create a schedule to run the runbook at your desired frequency 115 | 116 | ## Accessing Reports 117 | 118 | The inventory reports will be automatically saved to the specified storage container. You can access them through the Azure Portal or using tools that connect to Azure Storage. 119 | 120 | ## Troubleshooting 121 | 122 | If you encounter issues with your automated inventory: 123 | 124 | 1. Check the runbook logs for any error messages 125 | 2. Verify that the identity has all required permissions 126 | 3. Ensure all required modules are imported and up to date 127 | 4. Verify the storage account and container exist and are accessible 128 | 129 | ## Alternative Automation Options 130 | 131 | As alternatives to Azure Automation Accounts, you can use these options to run ARI on a schedule: 132 | 133 | ### GitHub Actions 134 | 135 | GitHub Actions provides a flexible way to automate ARI, especially if you're already using GitHub for infrastructure-as-code management. This approach is simpler to set up and maintain in GitHub-centric environments. 136 | 137 | See the [GitHub Actions Guide](github-actions.md) for a complete walkthrough of setting up ARI with GitHub Actions. 138 | 139 | ### Azure DevOps Pipelines 140 | 141 | Azure DevOps Pipelines offer another robust option for running ARI automatically, particularly well-suited for organizations already using Azure DevOps for their development and operations workflows. 142 | 143 | See the [Azure DevOps Guide](azure-devops.md) for instructions on setting up ARI with Azure DevOps Pipelines. -------------------------------------------------------------------------------- /docs/development/contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing to Azure Resource Inventory 2 | 3 | Thank you for your interest in contributing to Azure Resource Inventory! This guide will help you get started with contributing to the project. 4 | 5 | ## Ways to Contribute 6 | 7 | There are many ways to contribute to Azure Resource Inventory: 8 | 9 | - Report bugs and issues 10 | - Suggest new features or improvements 11 | - Improve documentation 12 | - Submit pull requests with code changes 13 | - Share your experiences using ARI 14 | 15 | ## Getting Started 16 | 17 | ### Prerequisites 18 | 19 | To contribute to the codebase, you'll need: 20 | 21 | - PowerShell 7.0 or higher (recommended) 22 | - Azure PowerShell modules 23 | - Git 24 | - An Azure subscription for testing 25 | - Visual Studio Code or another editor 26 | 27 | ### Setting Up Your Development Environment 28 | 29 | 1. Fork the repository on GitHub 30 | 2. Clone your fork to your local machine: 31 | ``` 32 | git clone https://github.com/your-username/ARI.git 33 | ``` 34 | 3. Add the upstream repository as a remote: 35 | ``` 36 | git remote add upstream https://github.com/microsoft/ARI.git 37 | ``` 38 | 4. Create a new branch for your changes: 39 | ``` 40 | git checkout -b my-feature-branch 41 | ``` 42 | 43 | ## Development Guidelines 44 | 45 | ### Code Style 46 | 47 | - Follow PowerShell best practices 48 | - Use clear, descriptive variable and function names 49 | - Add appropriate comments for complex logic 50 | - Follow the existing code structure and patterns 51 | 52 | ### Adding Features 53 | 54 | 1. If adding a new resource type: 55 | - Create a new module in the appropriate directory under `Modules/Public/InventoryModules/` 56 | - Follow the existing resource type module patterns 57 | - Update the resource types documentation 58 | 59 | 2. If enhancing existing functionality: 60 | - Maintain backward compatibility when possible 61 | - Test thoroughly on different Azure environments 62 | 63 | ### Testing Your Changes 64 | 65 | Before submitting a pull request: 66 | 67 | 1. Test your changes with different Azure environments if possible 68 | 2. Ensure no regressions in existing functionality 69 | 3. Verify the module loads without errors 70 | 4. Test any new parameters or functions 71 | 72 | ### Documentation 73 | 74 | When contributing new features or changes: 75 | 76 | 1. Update or add documentation for new functionality 77 | 2. Include examples of how to use new features 78 | 3. Update the parameter reference if adding parameters 79 | 80 | ## Pull Request Process 81 | 82 | 1. Ensure your code follows the style guidelines 83 | 2. Update documentation as necessary 84 | 3. Squash commits into logical units 85 | 4. Submit a pull request to the `main` branch 86 | 5. In the pull request description, explain the changes and the motivation behind them 87 | 88 | ### Pull Request Checklist 89 | 90 | - [ ] Code follows style guidelines 91 | - [ ] Tests added/updated for new functionality 92 | - [ ] Documentation updated 93 | - [ ] Changes maintain backward compatibility (or explain breaking changes) 94 | - [ ] Squashed commits with clear messages 95 | 96 | ## Issue Reporting 97 | 98 | If you find a bug or have a feature request: 99 | 100 | 1. Check if the issue already exists in the [GitHub issue tracker](https://github.com/microsoft/ARI/issues) 101 | 2. If not, create a new issue with a clear description 102 | 3. For bugs, include: 103 | - Steps to reproduce 104 | - Expected behavior 105 | - Actual behavior 106 | - PowerShell and module versions 107 | - Any error messages 108 | 109 | ## Getting Help 110 | 111 | If you need help with your contribution: 112 | 113 | - Ask questions in the issue for your pull request 114 | - Reach out to the maintainers 115 | - Check the [README](https://github.com/microsoft/ARI/blob/main/README.md) for additional information 116 | 117 | ## Code of Conduct 118 | 119 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 120 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/). 121 | 122 | ## Thank You 123 | 124 | Your contributions to Azure Resource Inventory help improve the tool for everyone. We appreciate your time and effort! -------------------------------------------------------------------------------- /docs/features/azure-advisor.md: -------------------------------------------------------------------------------- 1 | # Azure Advisor Integration 2 | 3 | Azure Resource Inventory integrates with Azure Advisor to include recommendations and best practices in your inventory reports. This page explains how to use and interpret Azure Advisor data in ARI. 4 | 5 | ## Overview 6 | 7 | Azure Advisor is a personalized cloud consultant that provides recommendations to help you optimize your Azure deployments. When you run ARI, it collects Azure Advisor recommendations by default, giving you insights into: 8 | 9 | - Cost optimization opportunities 10 | - Performance improvement suggestions 11 | - High availability recommendations 12 | - Security enhancements 13 | - Operational excellence guidance 14 | 15 | ## Azure Advisor Data Collection 16 | 17 | ARI collects Azure Advisor data by default. If you want to skip this collection to make the report generation faster, use the `-SkipAdvisory` parameter: 18 | 19 | ```powershell 20 | Invoke-ARI -SkipAdvisory 21 | ``` 22 | 23 | ## Advisor Information Collected 24 | 25 | ARI collects the following information from Azure Advisor: 26 | 27 | ### Cost Recommendations 28 | 29 | - Idle and underutilized resources 30 | - Resources that could benefit from reserved instances 31 | - VM right-sizing opportunities 32 | - Potential savings calculations 33 | 34 | ### Performance Recommendations 35 | 36 | - VM SKU size optimizations 37 | - Premium storage usage opportunities 38 | - Throughput improvements 39 | - Application gateway optimizations 40 | 41 | ### High Availability Recommendations 42 | 43 | - Availability set configurations 44 | - Redundancy settings 45 | - Backup recommendations 46 | - Disaster recovery suggestions 47 | 48 | ### Security Recommendations 49 | 50 | - Endpoint protection 51 | - Security updates 52 | - Vulnerability assessments 53 | - Network security configurations 54 | 55 | ### Operational Excellence 56 | 57 | - Service health tracking 58 | - Resource configuration best practices 59 | - Monitoring and diagnostics settings 60 | 61 | ## Advisor Data in Reports 62 | 63 | Azure Advisor recommendations are integrated into the Excel report in these ways: 64 | 65 | 1. **Advisor Tab**: A dedicated worksheet with all advisor recommendations 66 | 2. **Resource Integration**: Related recommendations are indicated in resource-specific tabs 67 | 3. **Overview Summary**: Key recommendations highlighted in the overview tab 68 | 69 | ## Using Advisor Recommendations 70 | 71 | ### Identifying Quick Wins 72 | 73 | Azure Advisor helps you identify immediate improvements: 74 | 75 | ```powershell 76 | Invoke-ARI -ReportName "OptimizationOpportunities" 77 | ``` 78 | 79 | Then look for "High" impact recommendations in the Advisor tab. 80 | 81 | ### Cost Optimization Reviews 82 | 83 | Generate a report focused on cost savings: 84 | 85 | ```powershell 86 | Invoke-ARI -IncludeCosts 87 | ``` 88 | 89 | Review both the Advisor tab and the cost data for complete optimization opportunities. 90 | 91 | ### Compliance and Best Practices 92 | 93 | Use Advisor recommendations to improve your environment's adherence to best practices: 94 | 95 | ```powershell 96 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" 97 | ``` 98 | 99 | ## Combining with Other Features 100 | 101 | ### Advisor with Security Center 102 | 103 | For a comprehensive view of optimization and security: 104 | 105 | ```powershell 106 | Invoke-ARI -SecurityCenter 107 | ``` 108 | 109 | ### Automated Optimization Reviews 110 | 111 | Schedule regular optimization reviews using automation: 112 | 113 | ```powershell 114 | Invoke-ARI -Automation -StorageAccount "mystorageaccount" -StorageContainer "advisorreports" 115 | ``` 116 | 117 | ## Limitations 118 | 119 | - Advisor recommendations are point-in-time and may change as your environment evolves 120 | - Some recommendations may require context not available in the report 121 | - Implementation complexity for recommendations isn't always indicated 122 | - Recommendations may not account for business constraints or requirements 123 | - Very recent changes to your environment may not be reflected in recommendations 124 | 125 | ## Disabling Advisor Data Collection 126 | 127 | If you want to generate reports without Azure Advisor data (for faster report generation): 128 | 129 | ```powershell 130 | Invoke-ARI -SkipAdvisory 131 | ``` 132 | 133 | This can be useful for: 134 | - Quick inventory reports when recommendations aren't needed 135 | - Environments with many resources where Advisor data collection is time-consuming 136 | - Regular operational reports where recommendations are only needed periodically -------------------------------------------------------------------------------- /docs/features/excel-reports.md: -------------------------------------------------------------------------------- 1 | # Excel Reports 2 | 3 | Azure Resource Inventory generates comprehensive Excel reports that provide detailed information about your Azure environment. This page explains the structure and content of these reports. 4 | 5 | ## Report Overview 6 | 7 | The Excel report is the primary output of Azure Resource Inventory. It contains multiple worksheets, each dedicated to a specific resource type or summary view. The report is designed to be: 8 | 9 | - **Comprehensive**: Covering all resource types in your environment 10 | - **Well-formatted**: With consistent styling and visual aids 11 | - **Filterable**: Allowing you to quickly find specific resources 12 | - **Interactive**: Including charts and visual summaries where appropriate 13 | 14 |
15 | 16 |
17 | 18 | ## Report Structure 19 | 20 | ### Overview Sheet 21 | 22 | The first sheet provides a high-level summary of your Azure environment, including: 23 | 24 | - Total number of resources by type 25 | - Subscription distribution 26 | - Resource group statistics 27 | - Charts visualizing resource distribution 28 | 29 | ### Resource Type Sheets 30 | 31 | Each Azure resource type has its own dedicated worksheet with relevant details. For example: 32 | 33 | - **Virtual Machines**: CPU, memory, OS, size, status, etc. 34 | - **Storage Accounts**: Type, tier, replication, access tier, etc. 35 | - **Virtual Networks**: Address space, subnets, peerings, etc. 36 | 37 | ### Tag-Based Information 38 | 39 | When you run ARI with the `-IncludeTags` parameter, resource tags are included in each resource sheet, allowing you to: 40 | 41 | - Filter resources by tag values 42 | - Understand resource ownership 43 | - Track environment designations (production, development, etc.) 44 | 45 | ## Data Visualization 46 | 47 | The Excel report includes various visualizations to help you understand your environment: 48 | 49 | - **Charts**: Distribution of resources by type, location, etc. 50 | - **Conditional Formatting**: Color-coding for status, size, or configuration concerns 51 | - **Data Tables**: Structured presentation of resource properties 52 | 53 | ## Report Customization 54 | 55 | ### Lite Mode 56 | 57 | For faster report generation, you can use the `-Lite` parameter, which: 58 | 59 | - Skips chart creation 60 | - Uses simplified formatting 61 | - Focuses on core resource information 62 | 63 | ### Custom Report Naming 64 | 65 | You can customize the report name and location: 66 | 67 | ```powershell 68 | Invoke-ARI -ReportName "MyCustomReport" -ReportDir "C:\Reports" 69 | ``` 70 | 71 | ### Filtering Options 72 | 73 | The generated Excel report supports standard Excel filtering. You can: 74 | 75 | - Filter by any column 76 | - Sort data by any property 77 | - Create pivot tables for advanced analysis 78 | 79 | ## Using the Report 80 | 81 | ### Best Practices 82 | 83 | 1. **Regular Updates**: Generate reports regularly to track changes over time 84 | 2. **Version Control**: Save reports with date-based naming for historical tracking 85 | 3. **Sharing**: The Excel format makes it easy to share with stakeholders 86 | 87 | ### Common Analysis Scenarios 88 | 89 | 1. **Cost Optimization**: Identify unused or oversized resources 90 | 2. **Security Review**: Check for open NSG rules or misconfigured resources 91 | 3. **Governance Validation**: Ensure resources follow tagging conventions 92 | 4. **Migration Planning**: Catalog resources before migration projects 93 | 94 | ### Limitations 95 | 96 | - Cloud Shell reports won't have auto-fit columns due to environment limitations 97 | - Very large environments may have performance impacts in Excel 98 | - Some complex resource properties may be summarized rather than fully expanded 99 | 100 | ## Automation Output 101 | 102 | When using ARI with `-Automation`, the Excel report is saved to the specified Storage Account and container: 103 | 104 | ```powershell 105 | Invoke-ARI -Automation -StorageAccount "mystorageaccount" -StorageContainer "reports" 106 | ``` -------------------------------------------------------------------------------- /docs/features/network-diagrams.md: -------------------------------------------------------------------------------- 1 | # Network Diagrams 2 | 3 | Azure Resource Inventory (ARI) creates interactive network topology diagrams that provide a visual representation of your Azure networking environment. This page explains the diagram types, features, and usage. 4 | 5 | ## Diagram Overview 6 | 7 | ARI generates network diagrams in Draw.io format, offering visual insights into your Azure network architecture. These diagrams are designed to be: 8 | 9 | - **Interactive**: Clickable elements with detailed information on hover 10 | - **Comprehensive**: Complete view of network resources and their relationships 11 | - **Exportable**: Easy to export to various formats for documentation 12 | - **Customizable**: Editable in Draw.io for further refinement 13 | 14 |
15 | 16 |
17 | 18 | ## Diagram Types 19 | 20 | ### Network Topology View 21 | 22 | The main network diagram displays all virtual networks, subnets, peerings, gateways, and connections between resources: 23 | 24 |
25 | 26 |
27 | 28 | Interactive features show resource details on hover: 29 | 30 |
31 | 32 | 33 |
34 | 35 | ### Organization View 36 | 37 | The organization view displays your Azure hierarchy from management groups down to resource groups: 38 | 39 |
40 | 41 |
42 | 43 | ### Resources View 44 | 45 | The resources view presents subscriptions with their contained resources: 46 | 47 |
48 | 49 |
50 | 51 | ## Diagram Generation 52 | 53 | By default, ARI creates network diagrams when you run `Invoke-ARI`. You can control diagram generation with these parameters: 54 | 55 | ### Skip Diagram Creation 56 | 57 | If you're only interested in the Excel report or want faster execution, you can skip diagram generation: 58 | 59 | ```powershell 60 | Invoke-ARI -SkipDiagram 61 | ``` 62 | 63 | ### Generate Full Environment Diagram 64 | 65 | For a more comprehensive diagram that includes all network components: 66 | 67 | ```powershell 68 | Invoke-ARI -DiagramFullEnvironment 69 | ``` 70 | 71 | This option includes additional details such as: 72 | - All interconnections between resources 73 | - Load balancers and their backend pools 74 | - Application gateways and their configurations 75 | - Additional network security details 76 | 77 | ## Working with Diagrams 78 | 79 | ### Viewing Diagrams 80 | 81 | The generated `.drawio` files can be opened with: 82 | - [Draw.io desktop application](https://github.com/jgraph/drawio-desktop/releases) 83 | - [Draw.io web interface](https://app.diagrams.net/) 84 | - [VS Code with Draw.io extension](https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio) 85 | 86 | ### Interactive Features 87 | 88 | When viewing the diagram, you can: 89 | - Click on resources to select them 90 | - Hover over resources to see detailed information 91 | - Zoom in/out for different levels of detail 92 | - Drag resources to rearrange the layout 93 | - Export to various formats (PNG, PDF, SVG, etc.) 94 | 95 | ### Diagram Customization 96 | 97 | After opening in Draw.io, you can customize the diagrams: 98 | - Change colors and styles 99 | - Add additional information or annotations 100 | - Rearrange elements for better presentation 101 | - Add or remove elements as needed 102 | 103 | ## Diagram Outputs 104 | 105 | The diagrams are saved in the same directory as the Excel report, or to the location specified with the `-ReportDir` parameter. 106 | 107 | Three separate files are created: 108 | 1. Network topology diagram (Subnet-level details) 109 | 2. Organization hierarchy diagram 110 | 3. Subscription resources diagram 111 | 112 | ## Diagram Limitations 113 | 114 | - Very large environments with many networks may result in complex diagrams 115 | - Some resource properties may be abbreviated or simplified in the visualization 116 | - Custom routes and complex networking patterns may require manual adjustments for clarity 117 | - When using ARI with `-Automation`, diagrams are still generated but stored in blob storage -------------------------------------------------------------------------------- /docs/features/security-center.md: -------------------------------------------------------------------------------- 1 | # Security Center Integration 2 | 3 | Azure Resource Inventory can integrate with Azure Security Center to include security findings in your inventory reports. This page explains how to use this feature and interpret the results. 4 | 5 | ## Overview 6 | 7 | When you run ARI with the `-SecurityCenter` parameter, it collects security recommendations, alerts, and compliance status from Azure Security Center (now part of Microsoft Defender for Cloud). This information is included in the Excel report, providing you with a comprehensive view of your security posture alongside your resource inventory. 8 | 9 | ## Enabling Security Center Integration 10 | 11 | To include Security Center data in your inventory report, use the `-SecurityCenter` parameter: 12 | 13 | ```powershell 14 | Invoke-ARI -SecurityCenter 15 | ``` 16 | 17 | You can combine this with other parameters as needed: 18 | 19 | ```powershell 20 | Invoke-ARI -SubscriptionID "00000000-0000-0000-0000-000000000000" -SecurityCenter -ReportName "SecureInventory" 21 | ``` 22 | 23 | ## Prerequisites 24 | 25 | - Access to Azure Security Center/Microsoft Defender for Cloud 26 | - Appropriate permissions to read security data (Security Reader role or equivalent) 27 | - Security Center must be enabled on the subscriptions you're inventorying 28 | 29 | ## Security Information Collected 30 | 31 | ### Security Recommendations 32 | 33 | ARI collects security recommendations for resources, including: 34 | 35 | - Recommendation name and description 36 | - Resource affected 37 | - Severity (High, Medium, Low) 38 | - Status (Healthy, Unhealthy) 39 | - Remediation steps 40 | 41 | ### Security Alerts 42 | 43 | Active security alerts are collected, including: 44 | 45 | - Alert name and description 46 | - Affected resource 47 | - Severity and status 48 | - Detection time 49 | 50 | ### Regulatory Compliance 51 | 52 | If you have regulatory compliance features enabled in Security Center, ARI collects: 53 | 54 | - Compliance standards applied (e.g., PCI DSS, ISO 27001, NIST SP 800-53) 55 | - Compliance status for each standard 56 | - Control compliance status 57 | 58 | ## Report Structure 59 | 60 | Security data is integrated into the Excel report in several ways: 61 | 62 | 1. **Security Tab**: A dedicated worksheet with all security findings 63 | 2. **Resource Integration**: Security status indicated in individual resource tabs 64 | 3. **Summary View**: Security posture summary in the overview tab 65 | 66 | ## Interpreting Security Results 67 | 68 | ### Security Status Indicators 69 | 70 | The report uses color coding to highlight security issues: 71 | 72 | - **Red**: Critical or high-severity issues 73 | - **Yellow**: Medium-severity issues 74 | - **Green**: Healthy resources with no issues 75 | 76 | ### Prioritizing Remediation 77 | 78 | The security data helps you prioritize remediation efforts based on: 79 | 80 | 1. Severity of the issue 81 | 2. Importance of the affected resource 82 | 3. Compliance impact 83 | 84 | ## Example Use Cases 85 | 86 | ### Security Audit 87 | 88 | Generate a comprehensive security report for compliance auditing: 89 | 90 | ```powershell 91 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" -SecurityCenter -ReportName "SecurityAudit" 92 | ``` 93 | 94 | ### Regular Security Reviews 95 | 96 | Schedule weekly security status reviews using automation: 97 | 98 | ```powershell 99 | Invoke-ARI -SecurityCenter -Automation -StorageAccount "mystorageaccount" -StorageContainer "securityreports" 100 | ``` 101 | 102 | ### Security Baseline for New Projects 103 | 104 | Create a security baseline report before beginning a new project: 105 | 106 | ```powershell 107 | Invoke-ARI -SubscriptionID "00000000-0000-0000-0000-000000000000" -ResourceGroup "ProjectX" -SecurityCenter 108 | ``` 109 | 110 | ## Limitations 111 | 112 | - Free tier of Security Center provides limited data compared to standard tier 113 | - Some security recommendations may require context not available in the report 114 | - Security data collection may increase the time required to generate the report 115 | - Detailed security logs are not included, only summaries and recommendations -------------------------------------------------------------------------------- /docs/getting-started/installation.md: -------------------------------------------------------------------------------- 1 | # Installation Guide 2 | 3 | Azure Resource Inventory (ARI) is a PowerShell module that can be installed directly from the PowerShell Gallery. This guide will walk you through the necessary steps to get ARI up and running on your system. 4 | 5 | ## Prerequisites 6 | 7 | Before installing ARI, ensure you have the following prerequisites: 8 | 9 | - **PowerShell Version**: 10 | - PowerShell 7.0 or newer (recommended) 11 | - PowerShell 5.1 (minimum requirement) 12 | 13 | - **Azure Account**: 14 | - An Azure account with read access to the resources you want to inventory 15 | 16 | - **Required PowerShell Modules**: 17 | - ImportExcel 18 | - Az.Accounts 19 | - Az.ResourceGraph 20 | - Az.Storage 21 | - Az.Compute 22 | 23 | ## Installation Methods 24 | 25 | ### Method 1: Install from PowerShell Gallery (Recommended) 26 | 27 | The easiest way to install ARI is directly from the PowerShell Gallery: 28 | 29 | ```powershell 30 | Install-Module -Name AzureResourceInventory 31 | ``` 32 | 33 |
34 | 35 |
36 | 37 | If you encounter any permission issues during installation, try running PowerShell as an administrator or add the `-Scope CurrentUser` parameter: 38 | 39 | ```powershell 40 | Install-Module -Name AzureResourceInventory -Scope CurrentUser 41 | ``` 42 | 43 | ### Method 2: Manual Installation 44 | 45 | If you prefer to install the module manually: 46 | 47 | 1. Download the latest release from the [GitHub Releases page](https://github.com/microsoft/ARI/releases) 48 | 2. Extract the ZIP file to your PowerShell modules directory (typically `$HOME\Documents\PowerShell\Modules\`) 49 | 3. Ensure the module folder is named "AzureResourceInventory" 50 | 51 | ## Verification 52 | 53 | To verify that ARI is installed correctly, run: 54 | 55 | ```powershell 56 | Get-Module -ListAvailable AzureResourceInventory 57 | ``` 58 | 59 | You should see the AzureResourceInventory module listed with its version number. 60 | 61 | ## Importing the Module 62 | 63 | After installation, you need to import the module before using it: 64 | 65 | ```powershell 66 | Import-Module AzureResourceInventory 67 | ``` 68 | 69 |
70 | 71 |
72 | 73 | ## Updating ARI 74 | 75 | To update to the latest version of ARI from the PowerShell Gallery: 76 | 77 | ```powershell 78 | Update-Module -Name AzureResourceInventory 79 | ``` 80 | 81 | ## Troubleshooting Installation Issues 82 | 83 | If you encounter issues during installation: 84 | 85 | 1. **Module Dependencies**: Ensure all required modules are installed: 86 | ```powershell 87 | Install-Module -Name ImportExcel, Az.Accounts, Az.ResourceGraph, Az.Storage, Az.Compute 88 | ``` 89 | 90 | 2. **Permission Issues**: Try running PowerShell as Administrator or using `-Scope CurrentUser` 91 | 92 | 3. **Internet Connection**: Ensure you have an active internet connection to access the PowerShell Gallery 93 | 94 | 4. **PowerShellGet Version**: Update PowerShellGet if needed: 95 | ```powershell 96 | Install-Module -Name PowerShellGet -Force 97 | ``` 98 | 99 | ## Next Steps 100 | 101 | Now that you've installed ARI, proceed to the [Quick Start Guide](quick-start.md) to generate your first Azure inventory report. -------------------------------------------------------------------------------- /docs/getting-started/quick-start.md: -------------------------------------------------------------------------------- 1 | # Quick Start Guide 2 | 3 | This quick start guide will help you generate your first Azure Resource Inventory report with just a few simple commands. 4 | 5 | ## Basic Usage 6 | 7 | ### Step 1: Import the Module 8 | 9 | First, import the AzureResourceInventory module: 10 | 11 | ```powershell 12 | Import-Module AzureResourceInventory 13 | ``` 14 | 15 |
16 | 17 |
18 | 19 | ### Step 2: Authenticate to Azure 20 | 21 | If you're not already authenticated to Azure, ARI will prompt you to sign in when you run the command. Alternatively, you can authenticate explicitly first: 22 | 23 | ```powershell 24 | Connect-AzAccount 25 | ``` 26 | 27 | ### Step 3: Generate the Inventory 28 | 29 | To generate a basic inventory report for all accessible resources and subscriptions: 30 | 31 | ```powershell 32 | Invoke-ARI 33 | ``` 34 | 35 |
36 | 37 |
38 | 39 | That's it! The command will: 40 | 41 | 1. Connect to your Azure environment 42 | 2. Collect information about all resources you have access to 43 | 3. Generate an Excel report with detailed tabs for each resource type 44 | 4. Create network diagrams (unless you use the `-SkipDiagram` parameter) 45 | 5. Save the report in your current directory 46 | 47 | ## Common Quick Start Examples 48 | 49 | ### Specify a Tenant 50 | 51 | If you have access to multiple tenants and want to target a specific one: 52 | 53 | ```powershell 54 | Invoke-ARI -TenantID 55 | ``` 56 | 57 | ### Target a Specific Subscription 58 | 59 | To limit the report to a single subscription: 60 | 61 | ```powershell 62 | Invoke-ARI -SubscriptionID 63 | ``` 64 | 65 | ### Include Resource Tags 66 | 67 | To include all resource tags in your report: 68 | 69 | ```powershell 70 | Invoke-ARI -IncludeTags 71 | ``` 72 | 73 | ### Skip Network Diagram Generation 74 | 75 | To speed up the process by skipping network diagram generation: 76 | 77 | ```powershell 78 | Invoke-ARI -SkipDiagram 79 | ``` 80 | 81 | ### Include Security Center Data 82 | 83 | To include Security Center information in your report: 84 | 85 | ```powershell 86 | Invoke-ARI -SecurityCenter 87 | ``` 88 | 89 | ### Custom Report Name and Location 90 | 91 | To specify a custom name and location for your report: 92 | 93 | ```powershell 94 | Invoke-ARI -ReportName "MyAzureInventory" -ReportDir "C:\Reports" 95 | ``` 96 | 97 | ## Understanding the Output 98 | 99 | After running Invoke-ARI, you will get: 100 | 101 | 1. **Excel Report**: A comprehensive spreadsheet with tabs for each resource type 102 | 2. **Draw.io Diagrams**: Network topology diagrams in Draw.io format (if diagrams weren't skipped) 103 | 104 | The report will be saved to your current directory by default, or to the location specified with the `-ReportDir` parameter. 105 | 106 | ## Next Steps 107 | 108 | - Learn about all available [parameters](../user-guide/parameters.md) 109 | - Explore [common usage scenarios](../user-guide/common-scenarios.md) 110 | - Set up [automated inventory reports](../advanced/automation.md) -------------------------------------------------------------------------------- /docs/images/ARIAUT_Identity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIAUT_Identity.png -------------------------------------------------------------------------------- /docs/images/ARIAUT_NewRunTime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIAUT_NewRunTime.png -------------------------------------------------------------------------------- /docs/images/ARIAUT_Runbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIAUT_Runbook.png -------------------------------------------------------------------------------- /docs/images/ARIAUT_Runbookcmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIAUT_Runbookcmd.png -------------------------------------------------------------------------------- /docs/images/ARIAUT_Runtime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIAUT_Runtime.png -------------------------------------------------------------------------------- /docs/images/ARIAUT_RuntimePackages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIAUT_RuntimePackages.png -------------------------------------------------------------------------------- /docs/images/ARIFiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIFiles.png -------------------------------------------------------------------------------- /docs/images/ARI_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARI_Logo.png -------------------------------------------------------------------------------- /docs/images/ARIv35-Overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIv35-Overview.png -------------------------------------------------------------------------------- /docs/images/ARIv3DrawioHover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIv3DrawioHover.png -------------------------------------------------------------------------------- /docs/images/ARIv3DrawioPeer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIv3DrawioPeer.png -------------------------------------------------------------------------------- /docs/images/ARIv3ExcelExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ARIv3ExcelExample.png -------------------------------------------------------------------------------- /docs/images/AUTv4Runbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/AUTv4Runbook.png -------------------------------------------------------------------------------- /docs/images/AUTv4STGPerm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/AUTv4STGPerm.png -------------------------------------------------------------------------------- /docs/images/AUTv4Tenant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/AUTv4Tenant.png -------------------------------------------------------------------------------- /docs/images/Automation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/Automation.png -------------------------------------------------------------------------------- /docs/images/DefaultARI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/DefaultARI.png -------------------------------------------------------------------------------- /docs/images/Download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/Download.png -------------------------------------------------------------------------------- /docs/images/DrawioImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/DrawioImage.png -------------------------------------------------------------------------------- /docs/images/DrawioImport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/DrawioImport.png -------------------------------------------------------------------------------- /docs/images/DrawioOrganization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/DrawioOrganization.png -------------------------------------------------------------------------------- /docs/images/Extract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/Extract.png -------------------------------------------------------------------------------- /docs/images/ImportingARI.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/ImportingARI.gif -------------------------------------------------------------------------------- /docs/images/InstallARI.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/InstallARI.gif -------------------------------------------------------------------------------- /docs/images/RunningARI.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/RunningARI.gif -------------------------------------------------------------------------------- /docs/images/TenantsMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/TenantsMenu.png -------------------------------------------------------------------------------- /docs/images/Unblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/Unblock.png -------------------------------------------------------------------------------- /docs/images/cloudshell-warning-lib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/cloudshell-warning-lib.png -------------------------------------------------------------------------------- /docs/images/drawioopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/drawioopen.png -------------------------------------------------------------------------------- /docs/images/drawiosubs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/drawiosubs.png -------------------------------------------------------------------------------- /docs/images/multitenant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/multitenant.png -------------------------------------------------------------------------------- /docs/images/tenantID.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/docs/images/tenantID.png -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Azure Resource Inventory (ARI) 2 | 3 |
4 | 5 |
6 | 7 | ## Overview 8 | 9 | Azure Resource Inventory (ARI) is a comprehensive PowerShell module that generates detailed Excel reports of any Azure environment you have read access to. It is designed for Cloud Administrators and technical professionals who need an easy and fast way to document their Azure environments. 10 | 11 |
12 | 13 |
14 | 15 | ## Key Features 16 | 17 | - **Complete Resource Documentation**: Detailed inventory of all Azure resources 18 | - **Interactive Excel Reports**: Well-formatted spreadsheets with resources organized by type 19 | - **Visual Network Diagrams**: Generate interactive topology maps of your Azure environment 20 | - **Security Analysis**: Integration with Azure Security Center (optional) 21 | - **Cross-Platform Support**: Works on Windows, Linux, Mac, and Azure Cloud Shell 22 | - **Automation-Ready**: Can be deployed via Azure Automation Accounts 23 | - **Low-Impact**: Read-only operations with no changes to your environment 24 | 25 | ## Quick Links 26 | 27 | - [Installation Guide](getting-started/installation.md) 28 | - [Quick Start](getting-started/quick-start.md) 29 | - [Parameter Reference](user-guide/parameters.md) 30 | - [Common Scenarios](user-guide/common-scenarios.md) 31 | - [Automation Guide](advanced/automation.md) 32 | 33 | ## Output Examples 34 | 35 | ### Excel Report 36 | 37 |
38 | 39 |
40 | 41 | ### Network Topology View 42 | 43 |
44 | 45 |
46 | 47 | Interactive features show resource details on hover: 48 | 49 |
50 | 51 | 52 |
53 | 54 | ### Organization View 55 | 56 |
57 | 58 |
59 | 60 | ### Resources View 61 | 62 |
63 | 64 |
-------------------------------------------------------------------------------- /docs/user-guide/basic-usage.md: -------------------------------------------------------------------------------- 1 | # Basic Usage 2 | 3 | This guide covers the fundamental usage patterns for Azure Resource Inventory (ARI). For a quick start, see the [Quick Start Guide](../getting-started/quick-start.md). 4 | 5 | ## Command Structure 6 | 7 | The basic syntax for ARI is: 8 | 9 | ```powershell 10 | Invoke-ARI [parameters] 11 | ``` 12 | 13 | ## Authentication 14 | 15 | ARI supports multiple authentication methods: 16 | 17 | ### Interactive Login 18 | 19 | ```powershell 20 | # ARI will prompt for interactive login if not already authenticated 21 | Invoke-ARI 22 | ``` 23 | 24 | ### Specific Tenant 25 | 26 | ```powershell 27 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" 28 | ``` 29 | 30 | ### Service Principal 31 | 32 | ```powershell 33 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" -AppId "00000000-0000-0000-0000-000000000000" -Secret "your-client-secret" 34 | ``` 35 | 36 | ### Certificate-Based Authentication 37 | 38 | ```powershell 39 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" -AppId "00000000-0000-0000-0000-000000000000" -CertificatePath "C:\Certificates\cert.pfx" 40 | ``` 41 | 42 | ### Device Code Authentication 43 | 44 | ```powershell 45 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" -DeviceLogin 46 | ``` 47 | 48 | ## Scoping Your Inventory 49 | 50 | ARI can be scoped to different levels: 51 | 52 | ### All Accessible Resources 53 | 54 | ```powershell 55 | Invoke-ARI 56 | ``` 57 | 58 | ### Specific Subscription 59 | 60 | ```powershell 61 | Invoke-ARI -SubscriptionID "00000000-0000-0000-0000-000000000000" 62 | ``` 63 | 64 | ### Specific Resource Group 65 | 66 | ```powershell 67 | Invoke-ARI -SubscriptionID "00000000-0000-0000-0000-000000000000" -ResourceGroup "MyResourceGroup" 68 | ``` 69 | 70 | ### Management Group 71 | 72 | ```powershell 73 | Invoke-ARI -ManagementGroup "MyManagementGroup" 74 | ``` 75 | 76 | ### Tag-Based Filtering 77 | 78 | ```powershell 79 | # Resources with specific tag key 80 | Invoke-ARI -TagKey "Environment" 81 | 82 | # Resources with specific tag value 83 | Invoke-ARI -TagValue "Production" 84 | 85 | # Resources with specific tag key and value 86 | Invoke-ARI -TagKey "Environment" -TagValue "Production" 87 | ``` 88 | 89 | ## Report Content Control 90 | 91 | Control what information is included in your reports: 92 | 93 | ### Include Resource Tags 94 | 95 | ```powershell 96 | Invoke-ARI -IncludeTags 97 | ``` 98 | 99 | ### Include Security Center Data 100 | 101 | ```powershell 102 | Invoke-ARI -SecurityCenter 103 | ``` 104 | 105 | ### Skip Azure Policy Data 106 | 107 | ```powershell 108 | Invoke-ARI -SkipPolicy 109 | ``` 110 | 111 | ### Skip Azure VM Details 112 | 113 | ```powershell 114 | Invoke-ARI -SkipVMDetails 115 | ``` 116 | 117 | ### Skip Azure Advisory Collection 118 | 119 | ```powershell 120 | Invoke-ARI -SkipAdvisory 121 | ``` 122 | 123 | ### Include Cost Data 124 | 125 | ```powershell 126 | # Note: Requires Az.CostManagement module 127 | Invoke-ARI -IncludeCosts 128 | ``` 129 | 130 | ## Report Output Options 131 | 132 | Customize how the report is generated and saved: 133 | 134 | ### Custom Report Name 135 | 136 | ```powershell 137 | Invoke-ARI -ReportName "MyAzureInventory" 138 | ``` 139 | 140 | ### Custom Output Directory 141 | 142 | ```powershell 143 | Invoke-ARI -ReportDir "C:\Reports" 144 | ``` 145 | 146 | ### Lightweight Report Format 147 | 148 | ```powershell 149 | # Generate report without charts for faster processing 150 | Invoke-ARI -Lite 151 | ``` 152 | 153 | ## Diagram Options 154 | 155 | Control network diagram generation: 156 | 157 | ### Skip Diagram Creation 158 | 159 | ```powershell 160 | Invoke-ARI -SkipDiagram 161 | ``` 162 | 163 | ### Include All Network Components 164 | 165 | ```powershell 166 | Invoke-ARI -DiagramFullEnvironment 167 | ``` 168 | 169 | ## Other Common Options 170 | 171 | Additional options to control ARI behavior: 172 | 173 | ### Debug Mode 174 | 175 | ```powershell 176 | # Run in debug mode for detailed logging 177 | Invoke-ARI -Debug 178 | ``` 179 | 180 | ### Prevent Automatic Updates 181 | 182 | ```powershell 183 | # Skip automatic module updates 184 | Invoke-ARI -NoAutoUpdate 185 | ``` 186 | 187 | ### Specify Azure Environment 188 | 189 | ```powershell 190 | # For non-standard Azure environments 191 | Invoke-ARI -AzureEnvironment "AzureUSGovernment" 192 | ``` 193 | 194 | ## Using Cloud Shell 195 | 196 | When running in Azure Cloud Shell, it's recommended to use: 197 | 198 | ```powershell 199 | Invoke-ARI -Debug 200 | ``` 201 | 202 | This helps to work around certain limitations in the Cloud Shell environment. -------------------------------------------------------------------------------- /docs/user-guide/common-scenarios.md: -------------------------------------------------------------------------------- 1 | # Common Scenarios 2 | 3 | This guide covers common usage scenarios for Azure Resource Inventory. Each scenario includes the required commands and explains when you might want to use each approach. 4 | 5 | ## Scenario 1: Complete Enterprise Documentation 6 | 7 | When you need comprehensive documentation of your entire Azure estate across multiple subscriptions: 8 | 9 | ```powershell 10 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" -IncludeTags -SecurityCenter -IncludeCosts 11 | ``` 12 | 13 | This command will: 14 | - Document all resources in the tenant 15 | - Include all resource tags 16 | - Include Security Center findings 17 | - Include cost data for resources (requires Az.CostManagement module) 18 | 19 | ## Scenario 2: Quick Inventory for a Single Subscription 20 | 21 | When you need a fast overview of a specific subscription: 22 | 23 | ```powershell 24 | Invoke-ARI -SubscriptionID "00000000-0000-0000-0000-000000000000" -Lite -SkipDiagram 25 | ``` 26 | 27 | This command will: 28 | - Document only the specified subscription 29 | - Use lightweight reporting (no charts) 30 | - Skip diagram generation for faster results 31 | 32 | ## Scenario 3: Security-Focused Documentation 33 | 34 | When you need to assess the security posture of your Azure environment: 35 | 36 | ```powershell 37 | Invoke-ARI -SecurityCenter -ReportName "SecurityInventory" 38 | ``` 39 | 40 | This command will: 41 | - Include Azure Security Center findings 42 | - Name the report "SecurityInventory" 43 | 44 | ## Scenario 4: Network Topology Documentation 45 | 46 | When you need detailed network diagrams: 47 | 48 | ```powershell 49 | Invoke-ARI -DiagramFullEnvironment -ReportName "NetworkDiagrams" 50 | ``` 51 | 52 | This command will: 53 | - Generate comprehensive network diagrams 54 | - Include all network components in the diagrams 55 | - Name the report "NetworkDiagrams" 56 | 57 | ## Scenario 5: Production Environment Audit 58 | 59 | When you need to focus on your production resources: 60 | 61 | ```powershell 62 | Invoke-ARI -TagKey "Environment" -TagValue "Production" -IncludeTags 63 | ``` 64 | 65 | This command will: 66 | - Document only resources tagged with "Environment:Production" 67 | - Include all resource tags in the report 68 | 69 | ## Scenario 6: Regular Scheduled Reporting with Automation 70 | 71 | When you need to set up regular reports using Azure Automation: 72 | 73 | ```powershell 74 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" -Automation -StorageAccount "mystorageaccount" -StorageContainer "reports" 75 | ``` 76 | 77 | This command will: 78 | - Run in an Azure Automation Account 79 | - Save reports to the specified storage account and container 80 | 81 | See the [Automation Guide](../advanced/automation.md) for detailed setup instructions. 82 | 83 | ## Scenario 7: Non-Interactive Service Principal Access 84 | 85 | When you need to run ARI without interactive login: 86 | 87 | ```powershell 88 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" -AppId "00000000-0000-0000-0000-000000000000" -Secret "your-client-secret" 89 | ``` 90 | 91 | This command will: 92 | - Use service principal authentication 93 | - Require appropriate permissions for the service principal 94 | 95 | ## Scenario 8: Governance-Level Documentation with Policies 96 | 97 | When you need to focus on governance and compliance: 98 | 99 | ```powershell 100 | Invoke-ARI -ManagementGroup "governance-mg" -SkipDiagram 101 | ``` 102 | 103 | This command will: 104 | - Document all resources within the specified management group 105 | - Skip diagram generation to focus on resource details 106 | 107 | ## Scenario 9: Resource Group Comparison 108 | 109 | When you need to compare development, staging, and production environments: 110 | 111 | ```powershell 112 | # Run these separately to create three different reports 113 | Invoke-ARI -SubscriptionID "00000000-0000-0000-0000-000000000000" -ResourceGroup "dev-rg" -ReportName "Dev-Inventory" 114 | Invoke-ARI -SubscriptionID "00000000-0000-0000-0000-000000000000" -ResourceGroup "staging-rg" -ReportName "Staging-Inventory" 115 | Invoke-ARI -SubscriptionID "00000000-0000-0000-0000-000000000000" -ResourceGroup "prod-rg" -ReportName "Prod-Inventory" 116 | ``` 117 | 118 | This set of commands will: 119 | - Create separate inventory reports for each environment 120 | - Allow side-by-side comparison of resources 121 | 122 | ## Scenario 10: Running in Cloud Shell 123 | 124 | When you need to run ARI in Azure Cloud Shell: 125 | 126 | ```powershell 127 | Invoke-ARI -Debug -Lite -ReportName "CloudShellInventory" 128 | ``` 129 | 130 | This command will: 131 | - Run in debug mode to handle Cloud Shell limitations 132 | - Use lightweight reporting for better performance 133 | - Name the report "CloudShellInventory" -------------------------------------------------------------------------------- /docs/user-guide/parameters.md: -------------------------------------------------------------------------------- 1 | # Parameters Reference 2 | 3 | Azure Resource Inventory (ARI) offers a wide range of parameters to customize your inventory report generation. This page provides a comprehensive reference of all available parameters with detailed descriptions and examples. 4 | 5 | ## Core Parameters 6 | 7 | | Parameter | Description | Example | 8 | |-----------|-------------|---------| 9 | | **TenantID** | Specify the tenant ID for inventory | `-TenantID "00000000-0000-0000-0000-000000000000"` | 10 | | **SubscriptionID** | Specify subscription(s) to inventory | `-SubscriptionID "00000000-0000-0000-0000-000000000000"` | 11 | | **ResourceGroup** | Limit inventory to specific resource group(s) | `-ResourceGroup "MyResourceGroup"` | 12 | 13 | ## Authentication Parameters 14 | 15 | | Parameter | Description | Example | 16 | |-----------|-------------|---------| 17 | | **AppId** | Application ID for service principal auth | `-AppId "00000000-0000-0000-0000-000000000000"` | 18 | | **Secret** | Secret for service principal authentication | `-Secret "your-client-secret"` | 19 | | **CertificatePath** | Certificate path for service principal | `-CertificatePath "C:\certificates\cert.pfx"` | 20 | | **DeviceLogin** | Use device login authentication | `-DeviceLogin` | 21 | 22 | ## Scope Control Parameters 23 | 24 | | Parameter | Description | Example | 25 | |-----------|-------------|---------| 26 | | **ManagementGroup** | Inventory all subscriptions in management group | `-ManagementGroup "MyManagementGroup"` | 27 | | **TagKey** | Filter resources by tag key | `-TagKey "Environment"` | 28 | | **TagValue** | Filter resources by tag value | `-TagValue "Production"` | 29 | 30 | ## Content Options 31 | 32 | | Parameter | Description | Example | 33 | |-----------|-------------|---------| 34 | | **SecurityCenter** | Include Security Center data | `-SecurityCenter` | 35 | | **IncludeTags** | Include resource tags | `-IncludeTags` | 36 | | **SkipPolicy** | Skip Azure Policy collection | `-SkipPolicy` | 37 | | **SkipVMDetails** | Skip Azure VM Extra Details collection | `-SkipVMDetails` | 38 | | **SkipAdvisory** | Skip Azure Advisory collection | `-SkipAdvisory` | 39 | | **IncludeCosts** | Include Azure Cost details (requires Az.CostManagement) | `-IncludeCosts` | 40 | 41 | ## Output Options 42 | 43 | | Parameter | Description | Example | 44 | |-----------|-------------|---------| 45 | | **ReportName** | Custom report filename | `-ReportName "MyAzureInventory"` | 46 | | **ReportDir** | Custom directory for report | `-ReportDir "C:\Reports"` | 47 | | **Lite** | Use lightweight Excel generation (no charts) | `-Lite` | 48 | 49 | ## Diagram Options 50 | 51 | | Parameter | Description | Example | 52 | |-----------|-------------|---------| 53 | | **SkipDiagram** | Skip diagram creation | `-SkipDiagram` | 54 | | **DiagramFullEnvironment** | Include all network components in diagram | `-DiagramFullEnvironment` | 55 | 56 | ## Other Options 57 | 58 | | Parameter | Description | Example | 59 | |-----------|-------------|---------| 60 | | **Debug** | Run in debug mode | `-Debug` | 61 | | **NoAutoUpdate** | Skip the auto update of the ARI Module | `-NoAutoUpdate` | 62 | | **AzureEnvironment** | Specify Azure cloud environment | `-AzureEnvironment "AzureUSGovernment"` | 63 | | **Automation** | Run using Automation Account | `-Automation` | 64 | | **StorageAccount** | Storage account for automation output | `-StorageAccount "mystorageaccount"` | 65 | | **StorageContainer** | Storage container for automation output | `-StorageContainer "reports"` | 66 | 67 | ## Examples of Parameter Combinations 68 | 69 | ### Basic Inventory with Tags 70 | 71 | ```powershell 72 | Invoke-ARI -TenantID "00000000-0000-0000-0000-000000000000" -IncludeTags 73 | ``` 74 | 75 | ### Scoped Inventory with Security Data 76 | 77 | ```powershell 78 | Invoke-ARI -SubscriptionID "00000000-0000-0000-0000-000000000000" -SecurityCenter -ReportName "SecureInventory" 79 | ``` 80 | 81 | ### Production Environment Inventory 82 | 83 | ```powershell 84 | Invoke-ARI -TagKey "Environment" -TagValue "Production" -ReportDir "C:\Reports\Production" 85 | ``` 86 | 87 | ### Management Group Inventory with Service Principal 88 | 89 | ```powershell 90 | Invoke-ARI -ManagementGroup "MyMgmtGroup" -AppId "00000000-0000-0000-0000-000000000000" -Secret "your-client-secret" 91 | ``` 92 | 93 | ### Lightweight Report without Diagrams 94 | 95 | ```powershell 96 | Invoke-ARI -Lite -SkipDiagram 97 | ``` 98 | 99 | ### Full Network Documentation 100 | 101 | ```powershell 102 | Invoke-ARI -DiagramFullEnvironment 103 | ``` 104 | 105 | ### Automation Account Execution 106 | 107 | ```powershell 108 | Invoke-ARI -Automation -StorageAccount "mystorageaccount" -StorageContainer "reports" 109 | ``` -------------------------------------------------------------------------------- /images/ARIFiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/ARIFiles.png -------------------------------------------------------------------------------- /images/ARI_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/ARI_Logo.png -------------------------------------------------------------------------------- /images/ARIv35-Overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/ARIv35-Overview.png -------------------------------------------------------------------------------- /images/ARIv3DrawioHover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/ARIv3DrawioHover.png -------------------------------------------------------------------------------- /images/ARIv3DrawioPeer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/ARIv3DrawioPeer.png -------------------------------------------------------------------------------- /images/ARIv3ExcelExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/ARIv3ExcelExample.png -------------------------------------------------------------------------------- /images/Automation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/Automation.png -------------------------------------------------------------------------------- /images/DefaultARI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/DefaultARI.png -------------------------------------------------------------------------------- /images/Download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/Download.png -------------------------------------------------------------------------------- /images/DrawioImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/DrawioImage.png -------------------------------------------------------------------------------- /images/DrawioImport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/DrawioImport.png -------------------------------------------------------------------------------- /images/DrawioOrganization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/DrawioOrganization.png -------------------------------------------------------------------------------- /images/Extract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/Extract.png -------------------------------------------------------------------------------- /images/ImportingARI.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/ImportingARI.gif -------------------------------------------------------------------------------- /images/InstallARI.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/InstallARI.gif -------------------------------------------------------------------------------- /images/RunningARI.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/RunningARI.gif -------------------------------------------------------------------------------- /images/TenantsMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/TenantsMenu.png -------------------------------------------------------------------------------- /images/Unblock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/Unblock.png -------------------------------------------------------------------------------- /images/cloudshell-warning-lib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/cloudshell-warning-lib.png -------------------------------------------------------------------------------- /images/drawioopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/drawioopen.png -------------------------------------------------------------------------------- /images/drawiosubs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/drawiosubs.png -------------------------------------------------------------------------------- /images/multitenant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/multitenant.png -------------------------------------------------------------------------------- /images/tenantID.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ARI/dee4de7ed6b6011620aa6701ad29594ea09f7d87/images/tenantID.png -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: Azure Resource Inventory (ARI) 2 | site_description: Documentation for the Azure Resource Inventory PowerShell module 3 | site_author: Microsoft 4 | site_url: https://microsoft.github.io/ARI 5 | 6 | repo_name: microsoft/ARI 7 | repo_url: https://github.com/microsoft/ARI 8 | edit_uri: edit/main/docs/ 9 | 10 | theme: 11 | name: material 12 | logo: images/ARI_Logo.png 13 | favicon: images/ARI_Logo.png 14 | palette: 15 | primary: indigo 16 | accent: blue 17 | features: 18 | - navigation.tabs 19 | - navigation.sections 20 | - navigation.expand 21 | - navigation.top 22 | - search.highlight 23 | - content.tabs.link 24 | - content.code.copy 25 | 26 | plugins: 27 | - search 28 | 29 | markdown_extensions: 30 | - pymdownx.highlight 31 | - pymdownx.inlinehilite 32 | - pymdownx.snippets 33 | - pymdownx.superfences 34 | - admonition 35 | - pymdownx.details 36 | - tables 37 | - attr_list 38 | - md_in_html 39 | - footnotes 40 | 41 | extra: 42 | social: 43 | - icon: fontawesome/brands/github 44 | link: https://github.com/microsoft/ARI 45 | 46 | nav: 47 | - Home: index.md 48 | - Getting Started: 49 | - Installation: getting-started/installation.md 50 | - Quick Start: getting-started/quick-start.md 51 | - User Guide: 52 | - Basic Usage: user-guide/basic-usage.md 53 | - Parameters: user-guide/parameters.md 54 | - Common Scenarios: user-guide/common-scenarios.md 55 | - Troubleshooting: user-guide/troubleshooting.md 56 | - FAQ: user-guide/faq.md 57 | - Features: 58 | - Excel Reports: features/excel-reports.md 59 | - Network Diagrams: features/network-diagrams.md 60 | - Security Center: features/security-center.md 61 | - Azure Advisor: features/azure-advisor.md 62 | - Advanced: 63 | - Automation: advanced/automation.md 64 | - GitHub Actions: advanced/github-actions.md 65 | - Azure DevOps: advanced/azure-devops.md 66 | - Local Testing: advanced/local-testing.md 67 | - Resource Types: advanced/resource-types.md 68 | - Development: 69 | - Contributing: development/contributing.md 70 | - Module Structure: development/module-structure.md 71 | - About: 72 | - License: about/license.md 73 | - Authors: about/authors.md 74 | - Changelog: about/changelog.md -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | mkdocs==1.5.3 2 | mkdocs-material==9.4.5 3 | pymdown-extensions==10.3 4 | mkdocs-awesome-pages-plugin==2.9.2 -------------------------------------------------------------------------------- /test-azure-inventory-workflow.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "========================================================" 4 | echo "Testing Azure Inventory GitHub Action Workflow Locally" 5 | echo "========================================================" 6 | 7 | # Input parameters 8 | SUBSCRIPTION_ID="00000000-0000-0000-0000-000000000000" 9 | RESOURCE_GROUP="test-rg" 10 | REPORT_NAME="TestInventory" 11 | 12 | echo "Input Parameters:" 13 | echo "- SubscriptionID: $SUBSCRIPTION_ID" 14 | echo "- ResourceGroup: $RESOURCE_GROUP" 15 | echo "- ReportName: $REPORT_NAME" 16 | echo "========================================================" 17 | 18 | # Step 1: Clean up any previous test artifacts 19 | echo "Step 1: Cleaning up previous test artifacts..." 20 | if [ -d "ari-reports" ]; then 21 | echo "Removing existing ari-reports directory..." 22 | rm -rf ari-reports 23 | fi 24 | echo "Cleanup completed" 25 | echo "========================================================" 26 | 27 | # Step 2: Simulate Azure login 28 | echo "Step 2: Simulating Azure login..." 29 | echo "Azure login simulated for local testing" 30 | echo "========================================================" 31 | 32 | # Step 3: Simulate ARI Installation and Run 33 | echo "Step 3: Simulating ARI Installation and Run..." 34 | echo "Installing ARI modules (simulation for testing)" 35 | echo "Running Invoke-ARI with parameters:" 36 | echo "- ReportName: $REPORT_NAME" 37 | echo "- SubscriptionID: $SUBSCRIPTION_ID" 38 | echo "- ResourceGroup: $RESOURCE_GROUP" 39 | echo "========================================================" 40 | 41 | # Step 4: Create dummy report files 42 | echo "Step 4: Creating dummy report files..." 43 | mkdir -p ari-reports 44 | echo "This is a test Excel report for $REPORT_NAME" > "ari-reports/${REPORT_NAME}.xlsx" 45 | echo "This is a test diagram file for $REPORT_NAME" > "ari-reports/${REPORT_NAME}.drawio" 46 | 47 | echo "Created files:" 48 | ls -la ari-reports/ 49 | echo "========================================================" 50 | 51 | echo "Azure Inventory workflow test completed successfully!" 52 | echo "In a real GitHub Actions run, these files would be uploaded as artifacts" 53 | echo "========================================================" 54 | -------------------------------------------------------------------------------- /test-azure-inventory.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Testing Azure Inventory workflow locally using act..." 4 | 5 | # Check if act is installed 6 | if ! command -v act &> /dev/null; then 7 | echo "Error: 'act' is not installed." 8 | echo "Please install act to test GitHub Actions locally:" 9 | echo " macOS: brew install act" 10 | echo " Other: https://github.com/nektos/act#installation" 11 | exit 1 12 | fi 13 | 14 | # Run act to test the workflow locally 15 | echo "Running the run-inventory job with workflow_dispatch event" 16 | act -j run-inventory -W .github/workflows/azure-inventory.yml -e workflow_dispatch.json --container-architecture linux/amd64 17 | -------------------------------------------------------------------------------- /test-docs-workflow.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "========================================================" 4 | echo "Testing Documentation GitHub Action Workflow Locally" 5 | echo "========================================================" 6 | 7 | # Step 1: Clean up any previous build 8 | echo "Step 1: Cleaning up previous build..." 9 | if [ -d "site" ]; then 10 | echo "Removing existing site directory..." 11 | rm -rf site 12 | fi 13 | echo "Cleanup completed" 14 | echo "========================================================" 15 | 16 | # Step 2: Install dependencies 17 | echo "Step 2: Installing dependencies..." 18 | if pip list | grep -q "mkdocs"; then 19 | echo "MkDocs already installed" 20 | else 21 | echo "Installing MkDocs and dependencies..." 22 | pip install -r requirements.txt 23 | fi 24 | echo "Dependencies installation completed" 25 | echo "========================================================" 26 | 27 | # Step 3: Build the site 28 | echo "Step 3: Building MkDocs site..." 29 | mkdocs build 30 | if [ $? -eq 0 ]; then 31 | echo "MkDocs site built successfully" 32 | else 33 | echo "Error building MkDocs site" 34 | exit 1 35 | fi 36 | echo "========================================================" 37 | 38 | # Step 4: Verify the site structure 39 | echo "Step 4: Verifying site structure..." 40 | if [ -d "site" ]; then 41 | echo "Site directory exists" 42 | echo "Files in site directory:" 43 | ls -la site 44 | else 45 | echo "Error: Site directory not found" 46 | exit 1 47 | fi 48 | echo "========================================================" 49 | 50 | # Step 5: Test serving the site locally 51 | echo "Step 5: Testing local server (will run for 5 seconds)..." 52 | mkdocs serve & 53 | SERVER_PID=$! 54 | sleep 5 55 | kill $SERVER_PID 56 | echo "Local server test completed" 57 | echo "========================================================" 58 | 59 | echo "Documentation workflow test completed successfully!" 60 | echo "To view the site locally, run: mkdocs serve" 61 | echo "To deploy to GitHub Pages, push changes to the main branch" 62 | echo "========================================================" 63 | -------------------------------------------------------------------------------- /test-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install dependencies if not already installed 4 | if ! command -v mkdocs &> /dev/null; then 5 | echo "Installing MkDocs and dependencies..." 6 | pip install -r requirements.txt 7 | else 8 | echo "MkDocs already installed." 9 | fi 10 | 11 | # Serve the documentation locally 12 | echo "Starting MkDocs server. Access the documentation at http://127.0.0.1:8000" 13 | mkdocs serve -------------------------------------------------------------------------------- /test-workflow.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Testing GitHub Actions workflow locally using act..." 4 | 5 | # Check if act is installed 6 | if ! command -v act &> /dev/null; then 7 | echo "Error: 'act' is not installed." 8 | echo "Please install act to test GitHub Actions locally:" 9 | echo " macOS: brew install act" 10 | echo " Other: https://github.com/nektos/act#installation" 11 | exit 1 12 | fi 13 | 14 | # Run act to test the workflow locally 15 | # Note: This will only build the docs, not deploy them 16 | echo "Running the build-and-deploy job (deployment requires GitHub Pages setup)" 17 | act -j build-and-deploy -W .github/workflows/documentation.yml --container-architecture linux/amd64 -------------------------------------------------------------------------------- /workflow_dispatch.json: -------------------------------------------------------------------------------- 1 | { 2 | "inputs": { 3 | "subscriptionId": "00000000-0000-0000-0000-000000000000", 4 | "resourceGroup": "test-rg", 5 | "reportName": "TestInventory" 6 | } 7 | } 8 | --------------------------------------------------------------------------------