Azure Resource Inventory .NET Tool - Inventories and documents Azure Tenant resources to a set of markdown files for specified tenant to a specified folder.
dotnet tool install -g ariUse -h / --help to get the current list of available commands and options.
ari --help
ari command --helpThe inventory command inventories tenants and outputs it's result as markdown files to specified output path.
ari inventory <tenantId> <outputpath> [options]By default it'll try authenticate using the DefaultAzureCredential which tries to authorize in the following order based on your environment.
- EnvironmentCredential
- WorkloadIdentityCredential
- ManagedIdentityCredential
- SharedTokenCacheCredential
- VisualStudioCredential
- VisualStudioCodeCredential
- AzureCliCredential
- AzurePowerShellCredential
- AzureDeveloperCliCredential
- InteractiveBrowserCredential
The recommended way is using a service principal with only the access required for it to document, you can do this by creating an app registration.
- Begin by creating an
App Registrationin Azure Entra for the report generator. This ensures that the report generator has precisely the required access, such as organization-wide read permissions or access to a limited set of subscriptions. - Assign the API permission
https://graph.microsoft.com/Organization.Read.Allto the createdApp Registration. - In my tenant, Admin consent is required for this permission.
- Add a role that allows the
App Registrationto read an organization. You can do this underSubscriptionmanagement in Azure andAccess Control (IAM). AddRole Assignment, find theApp Registrationand give itReadaccess. - Assign a secret to the
App Registrationand make a note of this secret.
With the Azure App Registration now configured, we are ready to proceed.
- Create a dedicated folder for the generated report.
- Set the environment variable
AZURE_TENANT_IDto the tenant ID (found in theApp Registrationoverview for your app). - Set the environment variable
AZURE_CLIENT_IDto the client ID (found in theApp Registrationoverview for your app). - Set the environment variable
AZURE_CLIENT_SECRETto the secret noted earlier. - Set the environment variable
AZURE_AUTHORITY_HOSTtohttps://login.microsoftonline.com/.
Assuming all the environment variables are correctly set, follow these steps:
dotnet tool install --global ARI
ari <AZURE_TENANT_ID> <FOLDER_FOR_REPORT>By following these steps, you should be able to run ARI successfully for the first time. If you encounter any issues, double-check the Azure App Registration setup and ensure that the environment variables are accurately configured.