The Azure Resource Discovery Tool is a PowerShell script that generates comprehensive inventory reports of your Azure environment. This tool creates detailed reports including resource metrics, usage statistics, and performance data from the previous 31 days.
This tool leverages read-only integrations with Azure APIs and Azure Monitor. Our goal is to deliver a reliable and efficient solution for Azure environment reporting, empowering you with comprehensive insights into your cloud resources and their utilisation.
Key Features:
- Read-only Azure API integration
- Automated Excel and JSON report generation
- 31-day historical metrics collection
- Parallel processing for improved performance
- Support for Azure Cloud Shell and local PowerShell environments
Before running the script, ensure your Azure user account has the following roles assigned:
- ✅ Reader Role - Access to view Azure resources
- ✅ Billing Reader Role - Access to billing and cost data
- ✅ Monitoring Reader Role - Access to Azure Monitor metrics
- ✅ Cost Management Reader Role - Access to cost management data
- No additional setup required
- Pre-authenticated environment
- All dependencies included
- Access at Azure Cloud Shell
- PowerShell 7 or later
- Azure CLI
- Azure CLI Account Extension
- Azure CLI Resource-Graph Extension (auto-installed by script)
For Azure Cloud Shell:
- Navigate to Azure Cloud Shell
- Ensure you're in PowerShell mode (not Bash)
- You're automatically authenticated
For Local Environment:
- Open PowerShell 7 as Administrator
- Ensure Azure CLI is installed and configured
Option A: Git Clone
git clone https://github.com/DNXLabs/azure-resource-discovery.gitOption B: Direct Download
- Click the green Code button on this repository
- Select Download ZIP
- Extract to your desired directory
- Azure Cloud Shell: Authentication is automatic
- Local PowerShell: You'll be redirected to Azure sign-in
You might get more than one authentication request due to different collector processes running in parallel.
-
Navigate to the script directory:
cd azure-resource-discovery
-
Run the script with your organization name:
./ResourceInventory.ps1 -ReportName "YourCompanyName" -ConcurrencyLimit 4
Scan specific subscription:
./ResourceInventory.ps1 -ReportName "CompanyName" -SubscriptionID "12345678-1234-1234-1234-123456789012"Scan specific resource group:
./ResourceInventory.ps1 -ReportName "CompanyName" -ResourceGroup "MyResourceGroup"Adjust performance settings:
./ResourceInventory.ps1 -ReportName "CompanyName" -ConcurrencyLimit 8Skip consumption metrics:
./ResourceInventory.ps1 -ReportName "CompanyName" -SkipConsumptionUpon completion, the script generates reports in the InventoryReports folder:
| File | Description |
|---|---|
Consumption_ResourcesReport_(date).json |
Cost and billing data |
Inventory_ResourcesReport_(date).json |
Complete resource inventory |
Metrics_ResourcesReport_(date).json |
Performance metrics data |
ResourcesReport_(date).xlsx |
Consolidated Excel report |
ResourcesReport_(date).zip |
All files compressed |
- Locate the output: Check the
InventoryReportsfolder - Rename the ZIP file: Include your company name (e.g.,
CompanyName_ResourcesReport_2024-01-15.zip) - Deliver to DNX team: Send the renamed ZIP file for analysis
If automatic compression fails:
cd InventoryReports
Compress-Archive -Path ./* -DestinationPath "CompanyName_ResourcesReport_$(Get-Date -Format 'yyyy-MM-dd').zip"| Parameter | Type | Description | Example |
|---|---|---|---|
ReportName |
String | Required. Company/customer name for file naming | -ReportName "AcmeCorp" |
TenantID |
String | Target specific Azure tenant | -TenantID "12345678-1234-1234-1234-123456789012" |
SubscriptionID |
String | Scan single subscription only | -SubscriptionID "87654321-4321-4321-4321-210987654321" |
ResourceGroup |
String | Scan specific resource group only | -ResourceGroup "Production-RG" |
| Parameter | Type | Description | Default | Example |
|---|---|---|---|---|
ConcurrencyLimit |
Integer | Parallel execution limit | 6 | -ConcurrencyLimit 8 |
SkipConsumption |
Switch | Skip cost/billing data collection | False | -SkipConsumption |
| Parameter | Type | Description | Example |
|---|---|---|---|
Appid |
String | Service Principal application ID | -Appid "app-id-here" |
Secret |
String | Service Principal client secret | -Secret "secret-here" |
DeviceLogin |
Switch | Use device code authentication | -DeviceLogin |
| Parameter | Type | Description | Example |
|---|---|---|---|
Debug |
Switch | Enable debug mode output | -Debug |
Downloaded ZIP File:
- If you download the ZIP file, Windows may mark the files as blocked for security reasons which is a known issue from GitHub
- Run the following PowerShell command to unblock all files in Resource Discovery in Azure folder
Get-ChildItem -Path . -Recurse | Unblock-File - After unblocking, you can execute the script from the folder
Authentication Errors:
- Ensure you have the required Azure roles assigned
- For local environments, run
az loginbefore executing the script - Multiple authentication prompts may appear due to parallel processing
Performance Issues:
- Reduce
ConcurrencyLimitif experiencing timeouts - Use
SkipConsumptionto speed up execution. This is not recommended, as it greatly reduces the usefulness of the report. - Consider targeting specific subscriptions or resource groups
Excel Formatting (Azure Cloud Shell):
- Auto-fit columns may not work in Cloud Shell
- Warning messages are expected and don't affect data accuracy
- Download and open locally for proper formatting
- The script does not upgrade existing PowerShell modules
- Resource-Graph extension installs automatically if missing
- All operations are read-only and safe to execute
- Historical data covers the previous 31 days
This tool is maintained by DNX Solutions and is based on the open-source AWS Labs Resource Discovery for Azure project.
DNX's use: DNX leverages this tool to help clients gain comprehensive visibility into their Azure environments, providing detailed insights for infrastructure assessments and planning.
Original project: https://github.com/awslabs/resource-discovery-for-azure
License: MIT-0 (See LICENSE file)

