No Resources Showing in Report
Hi,
We are trying to run the latest version (3.5) as of 15th October 2024 but it keeps failing to output the expected data.
We can see that it shows a lot of resources when the script completes, but that data is not exported to the Excel file as expected?
It also shows 40 subscriptions and there are more than that in that tenant. There are also no resources listed under Reported Resources, but at the bottom of the Debug, it notes that 9,216 were found.
Trying to figure out where we are going wrong with this?
Running with an account that has access to all resources
In the outputted Excel file we just see:
Debug Info as below: (Have removed anything that is private or should not be showing e.g CorrelationID changed to xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx)
Invoke-ARI -debug DEBUG: 2024-10-15_14_26_43 - Debbuging Mode: On. ErrorActionPreference was set to "Continue", every error will be presented. Checking for Powershell Module Updates.. DEBUG: 2024-10-15_14_26_45 - Starting Test-ARIPS function PowerShell Desktop Identified. AzureCloud Tenant ID not specified. Use -TenantID parameter if you want to specify directly. Authenticating Azure
Please select the account you want to login with.
Retrieving subscriptions for the selection...
WARNING: To override which subscription Connect-AzAccount selects by default, use Update-AzConfig -DefaultSubscriptionForLogin 00000000-0000-0000-0000-000000000000. Go to https://go.microsoft.com/fwlink/?linkid=2200610 for more information.
You have privileges only in One Tenant
Extracting Subscriptions from Tenant xxxxxx
DEBUG: 2024-10-15_14_26_55 - Checking report folder: C:\AzureResourceInventory
Starting Resource Extraction..
DEBUG: 2024-10-15_14_26_55 - Starting Extractor function
DEBUG: 2024-10-15_14_26_55 - Powershell Edition: Core
DEBUG: 2024-10-15_14_26_55 - Powershell Version: 7.4.5
DEBUG: 2024-10-15_14_26_55 - Tags will be ignored
DEBUG: 2024-10-15_14_26_55 - Number of Subscriptions Found: 50
DEBUG: 2024-10-15_14_26_55 - Invoking Inventory Loop for Resources
DEBUG: 2024-10-15_14_27_17 - Invoking Inventory Loop for Network Resources
DEBUG: 2024-10-15_14_27_18 - Invoking Inventory Loop for Backup Resources
DEBUG: 2024-10-15_14_27_19 - Invoking Inventory Loop for AVD Resources
DEBUG: 2024-10-15_14_27_19 - Invoking Inventory Loop for Resource Containers
DEBUG: 2024-10-15_14_27_20 - Invoking Inventory Loop for Advisories
DEBUG: 2024-10-15_14_27_35 - Starting API Inventory
DEBUG: 14:27:35 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 14:27:35 - GetAzureRmAccessTokenCommand begin processing with ParameterSet 'KnownResourceTypeName'.
DEBUG: 14:27:35 - using account id 'xxxxxxx'...
DEBUG: 14:27:35 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 14:27:35 - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 14:27:35 - [ConfigManager] Got [False] from [EnableLoginByWam], Module = [], Cmdlet = [].
DEBUG: 14:27:35 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'xxxx', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'xxxxx'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxx] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxx] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxx] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxx] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxx] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z] Returning 1 accounts
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] MSAL MSAL.CoreCLR with assembly version '4.61.3.0'. CorrelationId(xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx)
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] LoginHint provided: False
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] Account provided: True
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] ForceRefresh: False
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] === Token Acquisition (SilentRequest) started: Scopes: https://management.core.windows.net//.default Authority Host: login.microsoftonline.com DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] [Region discovery] Not using a regional authority. DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] Access token is not expired. Returning the found cache entry. [Current time (10/15/2024 13:27:35) - Expiration Time (10/15/2024 14:45:28 +00:00) - Extended Expiration Time (10/15/2024 14:45:28 +00:00)] DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] Returning access token found in cache. RefreshOn exists ? False DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] [Region discovery] Not using a regional authority. DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] === Token Acquisition finished successfully: DEBUG: False MSAL 4.61.3.0 MSAL.CoreCLR .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-10-15 13:27:35Z - xxxxxxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx] AT expiration time: 15/10/2024 14:45:28 +00:00, scopes: https://management.core.windows.net//.default https://management.core.windows.net//user_impersonation. source: Cache DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: ExpiresOn: 2024-10-15T14:45:28.0000000+00:00 DEBUG: 14:27:35 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: 14:27:35 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: 14:27:35 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: AzureQoSEvent: Module: Az.Accounts:3.0.4; CommandName: Get-AzAccessToken; PSVersion: 7.4.5; IsSuccess: True; Duration: 00:00:00.0735622; SanitizeDuration: 00:00:00.0005629 DEBUG: 14:27:35 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: 14:27:35 - GetAzureRmAccessTokenCommand end processing. Running API Inventory at: EDITED FOR PRIVACY
DEBUG: 2024-10-15_14_37_12 - Excel file: C:\AzureResourceInventory\AzureResourceInventory_Report_2024-10-15_14_37.xlsx DEBUG: 2024-10-15_14_37_12 - Starting Default Jobs. DEBUG: 2024-10-15_14_37_12 - Checking if Draw.io Diagram Job Should be Run. DEBUG: 2024-10-15_14_37_12 - Starting Draw.io Diagram Processing Job. DEBUG: 2024-10-15_14_37_13 - Checking If Should Run Security Center Job. DEBUG: 2024-10-15_14_37_13 - Checking If Should Run Policy Job. DEBUG: 2024-10-15_14_37_13 - Starting Policy Processing Job. DEBUG: 2024-10-15_14_37_13 - Checking If Should Run Advisory Job. DEBUG: 2024-10-15_14_37_13 - Starting Advisory Processing Job. DEBUG: 2024-10-15_14_37_13 - Starting Subscriptions job. DEBUG: 2024-10-15_14_37_14 - Starting Resources Report Function. DEBUG: 2024-10-15_14_37_14 - Excel Table Style used: Light19 DEBUG: 2024-10-15_14_37_14 - Importing List of Unsupported Versions. DEBUG: 2024-10-15_14_37_14 - Validating file: C:\Users\xxxx\Documents\PowerShell\Modules\AzureResourceInventory\3.5.6\Modules\Extras\Support.json DEBUG: 2024-10-15_14_37_14 - Starting Resource Jobs. DEBUG: 2024-10-15_14_37_15 - Starting Processing Jobs in Medium Mode. DEBUG: 2024-10-15_14_37_15 - Total Resources Being Processed: 10935 DEBUG: 2024-10-15_14_37_15 - Resources Being Processed in ResourceJob_1: 2500 Start-Job: Cannot start job. The language mode for this session is incompatible with the system-wide language mode. DEBUG: 2024-10-15_14_37_16 - Resources Being Processed in ResourceJob_2: 2500 Start-Job: Cannot start job. The language mode for this session is incompatible with the system-wide language mode. DEBUG: 2024-10-15_14_37_16 - Resources Being Processed in ResourceJob_3: 2500 Start-Job: Cannot start job. The language mode for this session is incompatible with the system-wide language mode. DEBUG: 2024-10-15_14_37_17 - Resources Being Processed in ResourceJob_4: 2500 Start-Job: Cannot start job. The language mode for this session is incompatible with the system-wide language mode. DEBUG: 2024-10-15_14_37_17 - Resources Being Processed in ResourceJob_5: 928 Start-Job: Cannot start job. The language mode for this session is incompatible with the system-wide language mode. DEBUG: 2024-10-15_14_37_17 - Starting Jobs Collector. Get-Job: Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. DEBUG: 2024-10-15_14_37_18 - Jobs Compleated. DEBUG: 2024-10-15_14_37_18 - Starting Default Data Reporting. DEBUG: 2024-10-15_14_37_18 - Checking if Should Generate Security Center Sheet. DEBUG: 2024-10-15_14_37_18 - Checking if Should Generate Policy Sheet. DEBUG: 2024-10-15_14_37_18 - Generating Policy Sheet. DEBUG: 2024-10-15_16_16_11 - Checking if Should Generate Advisory Sheet. DEBUG: 2024-10-15_16_16_11 - Generating Advisor Sheet. DEBUG: 2024-10-15_16_16_28 - Generating Subscription sheet. DEBUG: 2024-10-15_16_16_49 - Starting Resource Reporting. DEBUG: 2024-10-15_16_16_49 - Starting Reporting Phase. DEBUG: 2024-10-15_16_16_49 - Running Asynchronous, Gathering List Of Modules. DEBUG: 2024-10-15_16_16_49 - Modules Found: 83 DEBUG: 2024-10-15_16_16_49 - Large Environment. Looking for Cached Resource Files. DEBUG: 2024-10-15_16_16_49 - Starting to Process Modules. DEBUG: 2024-10-15_16_16_52 - Cleaning Variables to Release Memory. DEBUG: 2024-10-15_16_17_01 - Adjusting Header Details. DEBUG: 2024-10-15_16_17_01 - Adding Header Comments. DEBUG: 2024-10-15_16_17_13 - Generating Overview sheet (Charts). DEBUG: 2024-10-15_16_17_15 - Starting Excel Charts Customization. DEBUG: 2024-10-15_16_17_15 - Running in Full Mode. DEBUG: 2024-10-15_16_17_16 - Validating if Advisor and Policies are included. InvalidOperation: Cannot index into a null array. InvalidOperation: Cannot index into a null array. MethodException: Cannot convert argument "targetPositionId", with value: "Subscriptions", for "MoveAfter" to type "System.Int32": "Cannot convert value "Subscriptions" to type "System.Int32". Error: "The input string 'Subscriptions' was not in a correct format."" DEBUG: 16:18:32 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: 16:18:32 - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'. DEBUG: 16:18:32 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: 16:18:32 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: 16:18:32 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: 16:18:32 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: AzureQoSEvent: Module: Az.Accounts:3.0.4; CommandName: Get-AzContext; PSVersion: 7.4.5; IsSuccess: True; Duration: 00:00:00.0331002; SanitizeDuration: 00:00:00.0076084 DEBUG: 16:18:32 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True]. DEBUG: 16:18:32 - GetAzureRMContextCommand end processing. DEBUG: 2024-10-15_16_18_34 - Creating Overall Panel. DEBUG: 2024-10-15_16_18_52 - Creating Charts. WARNING: Failed adding PivotTable 'P3': Cannot index into a null array. WARNING: Failed adding chart for pivotable 'P3': Cannot bind argument to parameter 'PivotTable' because it is null. WARNING: Failed adding PivotTable 'P4': Cannot index into a null array. WARNING: Failed adding chart for pivotable 'P4': Cannot bind argument to parameter 'PivotTable' because it is null. DEBUG: 2024-10-15_16_19_08 - Validating if Excel is installed (Extra Customizations). InvalidOperation: The property 'ChartStyle' cannot be found on this object. Verify that the property exists and can be set. InvalidOperation: The property 'ChartStyle' cannot be found on this object. Verify that the property exists and can be set. InvalidOperation: The property 'ChartStyle' cannot be found on this object. Verify that the property exists and can be set. InvalidOperation: The property 'ChartStyle' cannot be found on this object. Verify that the property exists and can be set. InvalidOperation: The property 'ChartStyle' cannot be found on this object. Verify that the property exists and can be set. DEBUG: 2024-10-15_16_19_47 - Finished Charts Phase. Report Complete. Total Runtime was: 113.06 Minutes Total Resources: 9216 Total Advisories: 6243 Total Policies: 474
Hello @TheGift73
This is the issue: Start-Job: Cannot start job. The language mode for this session is incompatible with the system-wide language mode.
But I never have seen that error before.
Can you please run the following command to see what is the language mode in that session?
$ExecutionContext.SessionState.LanguageMode
Hi @Claudio-Merola
Thank you for this. This was the issue as PS (when run from a laptop) was in ConstrainedLanguage mode.
Ran on a PowerAutomate Server and the script worked as expected and all were present in the exported Excel sheet, with the exception of Policies. That isn't such an urgent issue though as we have another script that can get that information.
Also still only reports back 40 Subscriptions when we have 50
Thank you again for the help
Hi @TheGift73
Glad we find the ConstrainedLanguage mode issue.
All the Subscriptions are active and the account you are running the script has read permissions in these subscriptions?
When you run "Get-AzSubscription" do you see all the 50 subs?
This Issue is stale and may be automatically close soon.