diff --git a/images/linux/scripts/installers/Install-AzureModules.ps1 b/images/linux/scripts/installers/Install-AzureModules.ps1 index ca95efa4e..5a22ee69c 100644 --- a/images/linux/scripts/installers/Install-AzureModules.ps1 +++ b/images/linux/scripts/installers/Install-AzureModules.ps1 @@ -17,15 +17,24 @@ foreach ($module in $modules) Write-Host " - $version [$modulePath]" Save-Module -Path $modulePath -Name $moduleName -RequiredVersion $version -Force -Verbose } -} -# If Az.Accounts > 1.0.0 unable to load module with error: Assembly with same name is already loaded -# Force install Az.Accounts 1.0.0 -$azAccountsPath = "/usr/share/az_1.0.0/Az.Accounts" -if (Test-Path $azAccountsPath) -{ - Remove-Item -Path $azAccountsPath -Force -Recurse - Save-Module -Name Az.Accounts -Path "/usr/share/az_1.0.0" -RequiredVersion 1.0.0 -Force + $assets = Invoke-RestMethod $module.url + + # Get github release asset for each version + foreach ($toolVersion in $module.zip_versions) { + $asset = $assets | Where-Object version -eq $toolVersion ` + | Select-Object -ExpandProperty files ` + | Select-Object -First 1 + + Write-Host "Installing $($module.name) $toolVersion ..." + if ($null -ne $asset) { + Write-Host "Download $($asset.filename)" + wget $asset.download_url -nv --retry-connrefused --tries=10 -P $installPSModulePath + } else { + Write-Host "Asset was not found in versions manifest" + exit 1 + } + } } Invoke-PesterTests -TestFile "PowerShellModules" -TestName "AzureModules" diff --git a/images/linux/toolsets/toolset-1604.json b/images/linux/toolsets/toolset-1604.json index 386668a34..3b2247dbd 100644 --- a/images/linux/toolsets/toolset-1604.json +++ b/images/linux/toolsets/toolset-1604.json @@ -109,19 +109,13 @@ "azureModules": [ { "name": "az", + "url" : "https://raw.githubusercontent.com/Azure/az-ps-module-versions/main/versions-manifest.json", "versions": [ - "1.0.0", - "1.6.0", - "2.3.2", - "2.6.0", - "2.8.0", + "5.5.0" + ], + "zip_versions": [ "3.1.0", - "3.5.0", - "3.8.0", - "4.3.0", - "4.4.0", - "4.6.0", - "4.7.0" + "4.4.0" ] } ], diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index f0a1d002b..0e82254c7 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -105,19 +105,13 @@ "azureModules": [ { "name": "az", + "url" : "https://raw.githubusercontent.com/Azure/az-ps-module-versions/main/versions-manifest.json", "versions": [ - "1.0.0", - "1.6.0", - "2.3.2", - "2.6.0", - "2.8.0", + "5.5.0" + ], + "zip_versions": [ "3.1.0", - "3.5.0", - "3.8.0", - "4.3.0", - "4.4.0", - "4.6.0", - "4.7.0" + "4.4.0" ] } ], diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index bbe4f7ca6..954003397 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -103,9 +103,13 @@ "azureModules": [ { "name": "az", + "url" : "https://raw.githubusercontent.com/Azure/az-ps-module-versions/main/versions-manifest.json", "versions": [ - "3.8.0", - "4.8.0" + "5.5.0" + ], + "zip_versions": [ + "3.1.0", + "4.4.0" ] } ],