@@ -352,18 +352,29 @@ if (!$Clippy -and !$SkipBuild) {
352352if ($Test ) {
353353 $failed = $false
354354
355+ $usingADO = ($null -ne $env: TF_BUILD )
356+ $repository = ' PSGallery'
357+
358+ if ($usingADO ) {
359+ $repository = ' CFS'
360+ if ($null -eq (Get-PSResourceRepository - Name CFS - ErrorAction Ignore)) {
361+ " Registering CFS repository"
362+ Register-PSResourceRepository - uri ' https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2' - Name CFS - Trusted
363+ }
364+ }
365+
355366 if ($IsWindows ) {
356367 # PSDesiredStateConfiguration module is needed for Microsoft.Windows/WindowsPowerShell adapter
357368 $FullyQualifiedName = @ {ModuleName = " PSDesiredStateConfiguration" ;ModuleVersion = " 2.0.7" }
358369 if (-not (Get-Module - ListAvailable - FullyQualifiedName $FullyQualifiedName ))
359- { " Installing module PSDesiredStateConfiguration 2.0.7 "
360- Install-PSResource - Name PSDesiredStateConfiguration - Version 2.0 .7 - Repository PSGallery - TrustRepository
370+ {
371+ Install-PSResource - Name PSDesiredStateConfiguration - Version 2.0 .7 - Repository $repository - TrustRepository
361372 }
362373 }
363374
364375 if (-not (Get-Module - ListAvailable - Name Pester))
365376 { " Installing module Pester"
366- Install-PSResource Pester - WarningAction Ignore - Repository PSGallery - TrustRepository
377+ Install-PSResource Pester - WarningAction Ignore - Repository $repository - TrustRepository
367378 }
368379
369380 foreach ($project in $projects ) {
@@ -408,7 +419,7 @@ if ($Test) {
408419 if (-not (Get-Module - ListAvailable - Name Pester))
409420 { " Installing module Pester"
410421 $InstallTargetDir = ($env: PSModulePath -split " ;" )[0 ]
411- Find-PSResource - Name ' Pester' - Repository ' PSGallery ' | Save-PSResource - Path $InstallTargetDir - TrustRepository
422+ Find-PSResource - Name ' Pester' - Repository $repository | Save-PSResource - Path $InstallTargetDir - TrustRepository
412423 }
413424
414425 " Updated Pester module location:"
0 commit comments