Skip to content

Fix flag handling bugs and load background jobs from the running module - #409

Merged
Claudio Merola (Claudio-Merola) merged 5 commits into
microsoft:mainfrom
RobinpZA:fix/flag-handling
Oct 7, 2026
Merged

Claudio Merola (Claudio-Merola) merged 5 commits into
microsoft:mainfrom
RobinpZA:fix/flag-handling

Conversation

@RobinpZA

@RobinpZA Robin Pieterse (RobinpZA) commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Small bug fixes in flag handling and job setup. Each fix is its own commit.

Fixes

  • -IncludeTags never turned on small-batch mode. Invoke-ARI stores it as a plain [bool] ($InTag), but Start-ARIProcessJob and Start-ARIAutProcessJob checked $InTag.IsPresent, which is always $null on a bool. They now use if ($Heavy -or $InTag).
  • exit closed the user's PowerShell session. Invoke-ARI, Invoke-AzureRAMPInventory, Get-ARIManagementGroups and Start-ARIGraphExtraction called exit on bad input or a failed managed-identity login. They now throw with the same message.
  • The diagram log was never uploaded with -Debug. $Debug is not a variable, so $Debug.IsPresent was always false. Replaced with $PSBoundParameters.ContainsKey('Debug').
  • -Help showed outdated text (for example a -Online parameter that no longer exists). It now calls Get-Help Invoke-ARI -Full, which uses the existing comment-based help.
  • AzureGermanCloud is retired (closed October 2021). Removed it from the -AzureEnvironment options.
  • Invoke-ARISecurityCenterJob didn't declare $SecurityCenter. It read the caller's variable through dynamic scoping. It's now a declared parameter. No change in behaviour.
  • Background jobs loaded the installed gallery copy of ARI. Start-ARIExtraJobs imported the module by name in each job, so when ARI was loaded from a clone or a local path, the advisory, policy, security, subscription and diagram jobs still ran the gallery version. The jobs now import from the running module's ModuleBase.

Testing

  • All changed files parse. PSScriptAnalyzer reports no errors on them.
  • Invoke-ARI -Help returns without ending the session.
  • Live run against a real subscription with -IncludeTags -Debug -SkipDiagram. Output showed "Heavy Mode or InTag Mode Detected", jobs ran in batches of 5, and the report built (247 resources, 180 advisories).

🤖 Generated with Claude Code

Microsoft Reviewers: Open in CodeFlow

…de batching

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Claudio-Merola
Claudio Merola (Claudio-Merola) merged commit b6e74d5 into microsoft:main Oct 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants