JulianHayward / Azure-MG-Sub-Governance-Reporting

Azure Governance Visualizer aka AzGovViz is a PowerShell script that captures Azure Governance related information such as Azure Policy, RBAC (a lot more) by polling Azure ARM, Storage and Microsoft Graph APIs.
MIT License
858 stars 308 forks source link

AzAPICall Module Validation Failing #204

Closed cocallaw closed 1 year ago

cocallaw commented 1 year ago

AzGovViz version 6.3.0

CodeRunPlatform PowerShell 7.3.6 Windows Terminal AAD User Account

Describe the bug AzGovVizParallel.ps1 fails to complete validation check for AzAPICall Module, even though current version (1.1.75) and specified version (1.1.72) are currently installed. When prompted by the script to install the module by typing y, I can see the installation process occurring, but validation check does not pass and I am asked to install again.

Screenshots Error Output

Start Azure Governance Visualizer 19-Jul-2023 16:18:44 (#6.3.0)
Checking PowerShell edition and version
  PS check passed : (Major[7]; Minor[3] gt 0); (minimum supported version '7.0.3')
  PS Edition: Core; PS Version: 7.3.6
  PS Version check succeeded
Output/Files will be created in path 'C:\Source\test\.'
 Verify 'AzAPICall' (1.1.72)
  AzAPICall - Deviating module version 1.1.75
  'AzAPICall 1.1.72' not installed
  Do you want to install AzAPICall module (1.1.72) from the PowerShell Gallery? (y/n): y
  AzAPICall - Deviating module version 1.1.75
  'AzAPICall 1.1.72' not installed
  Do you want to install AzAPICall module (1.1.72) from the PowerShell Gallery? (y/n): y
  AzAPICall - Deviating module version 1.1.75
  'AzAPICall 1.1.72' not installed
  Do you want to install AzAPICall module (1.1.72) from the PowerShell Gallery? (y/n): y
 Managing 'AzAPICall' failed (tried 3x)
Exception: C:\Source\Local\Azure-MG-Sub-Governance-Reporting\pwsh\AzGovVizParallel.ps1:29078
 Line |
29078 |                  throw " Managing '$($module.ModuleName)' failed"
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |  Managing 'AzAPICall' failed
image


Additional context Reviewing the output of Get-Module -ListAvailable it appears that the AzAPICall Module is not being installed for PowerShell 7 Core but the native Windows PowerShell desktop version.

netkrish80 commented 1 year ago

Hi I also facing the same issue.

Start Azure Governance Visualizer 20-Jul-2023 16:30:56 (#6.2.1) Checking PowerShell edition and version PS check passed : (Major[7]; Minor[3] gt 0); (minimum supported version '7.0.3') PS Edition: Core; PS Version: 7.3.6 PS Version check succeeded Output/Files will be created in path 'C:\Azure\Reporting\Azure-MG-Sub-Governance-Reporting-master\Azure-MG-Sub-Governance-Reporting-master\pwsh.' Verify 'AzAPICall' (Group) AzAPICall - Deviating module version 1.1.75 'AzAPICall Group' not installed Do you want to install AzAPICall module (Group) from the PowerShell Gallery? (y/n): y Exception: C:\Azure\Reporting\Azure-MG-Sub-Governance-Reporting-master\Azure-MG-Sub-Governance-Reporting-master\pwsh\AzGovVizParallel.ps1:29114:33 Line | 29114 | … throw " 'Install-Module -Name $($module.ModuleName) -Req … | ~~~~~~~~~~~~~ | 'Install-Module -Name AzAPICall -RequiredVersion Group' failed

JulianHayward commented 1 year ago

@cocallaw agree this should be fixed/handled differently. As a workaround please simply uninstall the 1.1.75 version then it should work. @netkrish80 I guess you are passing a value (string, bool, etc.) to a switch parameter which causes this behavior

cocallaw commented 1 year ago

@JulianHayward adding more detail and update

cocallaw commented 1 year ago

@netkrish80 Please try running Uninstall-Module -Name AzAPICall -AllVersions, then relaunch your PowerShell session and try to run the AzGovVizParallel.ps1 script again

JulianHayward commented 1 year ago

thanks @cocallaw - updated readme and setup accordingly (hope so :))

netkrish80 commented 1 year ago

@cocallaw and @JulianHayward thank you for you suggestioin. After uninstall it worked.

JulianHayward commented 1 year ago

seems all are happy :) Thanks - closing..