2023-11-22 21:49:23 +01:00
|
|
|
################################################################################
|
|
|
|
|
## File: Install-PowerShellAzModules.ps1
|
|
|
|
|
## Desc: Install Az modules for PowerShell
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2020-12-23 15:18:48 +03:00
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
|
$ProgressPreference = "SilentlyContinue"
|
|
|
|
|
|
2023-12-27 18:39:58 +01:00
|
|
|
Import-Module "$env:HELPER_SCRIPTS/../tests/Helpers.psm1"
|
2020-12-23 15:18:48 +03:00
|
|
|
|
|
|
|
|
# Get modules content from toolset
|
|
|
|
|
$modules = (Get-ToolsetContent).azureModules
|
|
|
|
|
$installPSModulePath = "/usr/share"
|
|
|
|
|
|
2023-12-27 18:39:58 +01:00
|
|
|
foreach ($module in $modules) {
|
2020-12-23 15:18:48 +03:00
|
|
|
$moduleName = $module.name
|
2023-12-27 18:39:58 +01:00
|
|
|
|
2020-12-23 15:18:48 +03:00
|
|
|
Write-Host "Installing ${moduleName} to the ${installPSModulePath} path..."
|
2023-12-27 18:39:58 +01:00
|
|
|
foreach ($version in $module.versions) {
|
2020-12-23 15:18:48 +03:00
|
|
|
$modulePath = Join-Path -Path $installPSModulePath -ChildPath "${moduleName}_${version}"
|
|
|
|
|
Write-Host " - $version [$modulePath]"
|
2021-03-31 10:46:42 +03:00
|
|
|
Save-Module -Path $modulePath -Name $moduleName -RequiredVersion $version -Force
|
2020-12-23 15:18:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "AzureModules"
|