Skip to content
10 changes: 8 additions & 2 deletions eng/common/pipelines/templates/steps/run-pester-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ parameters:
steps:

- pwsh: |
Install-Module -Name Pester -Force
displayName: Install Pester
. (Join-Path "$(Build.SourcesDirectory)" eng common scripts Helpers PSModule-Helpers.ps1)
Install-ModuleIfNotInstalled "Pester" "5.7.1" | Import-Module

# Test: install powershell-yaml from internal feed (upstream to PSGallery)
$m = Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1"
Write-Host "Installed powershell-yaml version: $($m.Version)"
$m | Import-Module
displayName: Install Pester and test modules

# default test steps
- ${{ if eq(length(parameters.CustomTestSteps), 0) }}:
Expand Down
17 changes: 4 additions & 13 deletions eng/common/scripts/Helpers/PSModule-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,10 @@ function Update-PSModulePathForCI() {
}

function Get-ModuleRepositories([string]$moduleName) {
$DefaultPSRepositoryUrl = "https://www.powershellgallery.com/api/v2"
# List of modules+versions we want to replace with internal feed sources for reliability, security, etc.
$packageFeedOverrides = @{
'powershell-yaml' = 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-tools/nuget/v2'
}

$repoUrls = if ($packageFeedOverrides.Contains("${moduleName}")) {
@($packageFeedOverrides["${moduleName}"], $DefaultPSRepositoryUrl)
}
else {
@($DefaultPSRepositoryUrl)
}
# Use internal Azure Artifacts feed only.
$InternalPSRepositoryUrl = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-tools/nuget/v2"
Copy link
Copy Markdown
Member Author

@raych1 raych1 Apr 8, 2026

Choose a reason for hiding this comment

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

@weshaggard do we want to make this change to install powershell module from CFS? If so, we need to publish Az and Pester modules to the internal feed. They're missing from https://dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-tools

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please try adding the powershell gallery as an upstream to the feed and then use the tools feed to pull them through.


return $repoUrls
return @($InternalPSRepositoryUrl)
}

function moduleIsInstalled([string]$moduleName, [string]$version) {
Expand Down Expand Up @@ -153,6 +143,7 @@ function Install-ModuleIfNotInstalled() {

$repoUrls = Get-ModuleRepositories $moduleName

Write-Host "Module '$moduleName' with version '$version' is not installed. Attempting to install from $($repoUrls -join ", ")."
foreach ($url in $repoUrls) {
try {
$module = installModule -moduleName $moduleName -version $version -repoUrl $url
Expand Down
3 changes: 2 additions & 1 deletion eng/common/scripts/Verify-Resource-Ref.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
. (Join-Path $PSScriptRoot common.ps1)
Install-Module -Name powershell-yaml -RequiredVersion 0.4.7 -Force -Scope CurrentUser
. (Join-Path $PSScriptRoot Helpers PSModule-Helpers.ps1)
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.7" | Import-Module
$ymlfiles = Get-ChildItem $RepoRoot -recurse | Where-Object {$_ -like '*.yml'}
$affectedRepos = [System.Collections.ArrayList]::new()

Expand Down
2 changes: 1 addition & 1 deletion eng/scripts/Update-Artifacts-List-For-Patch-Release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (!(Test-Path $SourcesDirectory -PathType Container)) {
exit 1
}

Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.7" | Import-Module

$artifactsDict = [ordered]@{}
$addModulesDict = [ordered]@{}
Expand Down
2 changes: 1 addition & 1 deletion eng/versioning/pom_file_version_scanner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if ($UseVerboseLogging) {
Write-Host "SdkRoot=$SdkRoot"
}

Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.7" | Import-Module

$StartTime = $(get-date)

Expand Down
Loading