Skip to content

Commit 9c5ac39

Browse files
authored
fix: update ALZ module version checks to use Get-InstalledPSResource (#465)
# Pull Request ## Issue Issue #, if available: https://github.com/Azure/ALZ-PowerShell-Module/issues/461 ## Description Description of changes: This pull request updates the way the ALZ module is checked and retrieved in the `Test-Tooling` function, modernizing the approach to use the latest PowerShell resource management cmdlets for better compatibility and reliability. **Module management modernization:** * Replaced `Get-InstalledModule` with `Get-InstalledPSResource` for checking the installed ALZ module version, and updated the selection of properties to include `Name` and `Version`. * Replaced `Find-Module` with `Find-PSResource` for retrieving the latest available ALZ module version. ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license. Signed-off-by: Jan Egil Ring <janegilring@microsoft.com>
1 parent de5aa81 commit 9c5ac39

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/ALZ/Private/Tools/Test-Tooling.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,16 @@ function Test-Tooling {
160160
} else {
161161
# Check if latest ALZ module is installed
162162
Write-Verbose "Checking ALZ module version"
163-
$alzModuleCurrentVersion = Get-InstalledModule -Name ALZ -ErrorAction SilentlyContinue
163+
$alzModuleCurrentVersion = Get-InstalledPSResource -Name ALZ | Select-Object -Property Name, Version
164+
164165
if($null -eq $alzModuleCurrentVersion) {
165166
$checkResults += @{
166167
message = "ALZ module is not correctly installed. Please install the latest version using 'Install-Module ALZ'."
167168
result = "Failure"
168169
}
169170
$hasFailure = $true
170171
}
171-
$alzModuleLatestVersion = Find-Module -Name ALZ
172+
$alzModuleLatestVersion = Find-PSResource -Name ALZ
172173
if ($null -ne $alzModuleCurrentVersion) {
173174
if ($alzModuleCurrentVersion.Version -lt $alzModuleLatestVersion.Version) {
174175
$checkResults += @{

0 commit comments

Comments
 (0)