Skip to content

Conversation

@fume
Copy link

@fume fume commented Oct 7, 2024

Fixes prereq checks.

Closes #476

#>

Write-Host "Required modules are: Az.Resources, AzureAD, Az.Accounts" -ForegroundColor Cyan
Write-Host "Required modules are: Az.Resources, AzureAD (or AzureADPreview), Az.Accounts, Az.ResourceGraph" -ForegroundColor Cyan
Copy link
Contributor

@asimks asimks Oct 17, 2024

Choose a reason for hiding this comment

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

Is Az.ResourceGraph really being used? @MJaithra could you confirm

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the module Az.ResourceGraph is being used

# Checking if 'AzureAD' module is available or not.
if($availableModules.Name -notcontains 'AzureAD')
# Checking if 'AzureAD' or 'AzureADPreview' module is available or not.
if(($availableModules.Name -notcontains 'AzureAD') -and ($availableModules.Name -notcontains 'AzureADPreview'))
Copy link
Contributor

@asimks asimks Oct 17, 2024

Choose a reason for hiding this comment

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

Is any command being used which might be present in AzureAd but not in preview package. @MJaithra could you please check

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, a few commands, such as Get-AzureADTenantDetail and Get-AzureADObjectByObjectId are being used in this script which are available in the AzureAD module but not in the preview package.

To resolve this, we can force the installation of the AzureAD module, which will allow us to install it even if the preview module exists. Additionally, using the -Prefix parameter when importing the module can help prevent confusion between commands that are common to both modules.

Copy link
Contributor

Choose a reason for hiding this comment

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

So above code needs to be modified to support the installation of the AzureAD module even if preview is available

Copy link
Author

Choose a reason for hiding this comment

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

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.

PreReq checks are wrong

3 participants