Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Use Invoke-ARI Report to Generate Reports per Subscription Locally Without Repeated Logins? #230

Open
EelcoLabordus opened this issue Oct 23, 2024 · 4 comments

Comments

@EelcoLabordus
Copy link

EelcoLabordus commented Oct 23, 2024

Hi everyone,

I'm trying to use the Invoke-ARI report to generate individual reports for each subscription. Currently, I'm looping through the subscriptions locally without using an automation account. However, I'm encountering an issue where it tries to log in every time I move to the next subscription in the loop.

Is there a way to work around this locally without using an automation account or a managed identity? I need a separate report for each subscription, not a single report for all subscriptions.

Any help or guidance would be greatly appreciated!

Thanks in advance!

@red-erik
Copy link

Hello,
usually I do something like
invoke-ARI -TenantID "xxxxxxxxxxx" -SubscriptionID yyyyyyyy -DiagramFullEnvironment -Debug
ARI should request to login, 1 time, to access the Tenant so you will have all Subcriptions available.
Than, you can iterate with
invoke-ARI -TenantID "xxxxxxxxxxx" -SubscriptionID Different-yyyyyyyy -DiagramFullEnvironment -Debug

Regards,
Red.

@EelcoLabordus
Copy link
Author

It isn't working i get this error:

DEBUG: 2024-10-26_18_40_40 - Tenant ID was informed.
DEBUG: 18:40:40 - [ConfigManager] Got [True] from [DisplaySecretsWarning], Module = [], Cmdlet = [].
DEBUG: 18:40:40 - ClearAzureRmContext begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 18:40:40 - [ConfigManager] Got [False] from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
DEBUG: 18:40:40 - Autosave setting from startup session: 'CurrentUser'
DEBUG: 18:40:40 - No autosave setting detected in environment variable 'AzContextAutoSave'.
DEBUG: 18:40:40 - Using Autosave scope 'CurrentUser'
DEBUG: 18:40:40 - Autosave setting from startup session: 'CurrentUser'
DEBUG: 18:40:40 - No autosave setting detected in environment variable 'AzContextAutoSave'.
DEBUG: 18:40:40 - Using Autosave scope 'CurrentUser'
DEBUG: 18:40:40 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 18:40:40 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Accounts:3.0.4; CommandName: Clear-AzContext; PSVersion: 7.4.6; IsSuccess: True; Duration: 00:00:00.0320717; SanitizeDuration: 00:00:00
DEBUG: 18:40:40 - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: 18:40:40 - ClearAzureRmContext end processing.
DEBUG: 2024-10-26_18_40_40 - Editing Login Experience
DEBUG: 18:40:40 - [ConfigManager] Got [True] from [DisplaySecretsWarning], Module = [], Cmdlet = [].
DEBUG: 18:40:40 - GetConfigCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 18:40:40 - [ConfigManager] Got [False] from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
DEBUG: 18:40:40 - [ConfigManager] Got [True] from [DisplaySecretsWarning], Module = [], Cmdlet = [].
DEBUG: 18:40:40 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 18:40:40 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Accounts:3.0.4; CommandName: Get-AzConfig; PSVersion: 7.4.6; IsSuccess: True; Duration: 00:00:00.0025915; SanitizeDuration: 00:00:00.0000022
DEBUG: 18:40:40 - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: 18:40:40 - GetConfigCommand end processing.
DEBUG: 18:40:40 - [ConfigManager] Got [True] from [DisplaySecretsWarning], Module = [], Cmdlet = [].
DEBUG: 18:40:40 - ConnectAzureRmAccountCommand begin processing with ParameterSet 'UserWithSubscriptionId'.
DEBUG: 18:40:40 - [ConfigManager] Got [False] from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
DEBUG: 18:40:40 - Autosave setting from startup session: 'CurrentUser'
DEBUG: 18:40:40 - No autosave setting detected in environment variable 'AzContextAutoSave'.
DEBUG: 18:40:40 - Using Autosave scope 'CurrentUser'
DEBUG: 18:40:40 - [ConfigManager] Got nothing from [DefaultSubscriptionForLogin], Module = [], Cmdlet = []. Returning default value [].
DEBUG: 18:40:40 - Autosave setting from startup session: 'CurrentUser'
DEBUG: 18:40:40 - No autosave setting detected in environment variable 'AzContextAutoSave'.
DEBUG: 18:40:40 - Using Autosave scope 'CurrentUser'

The setting looks like itm has been enabled, what could i do wrong?

@red-erik
Copy link

red-erik commented Nov 5, 2024

Hello,
not sure but I think AzContextAutosave should help you
https://learn.microsoft.com/en-us/powershell/module/az.accounts/enable-azcontextautosave?view=azps-12.3.0

Regards,
Red.

Copy link

github-actions bot commented Dec 5, 2024

This Issue is stale and may be automatically close soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants