Skip to content

Use Find-PSResource to Azure Artifacts instead of Find-Module to PSGallery #27942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions tools/RunVersionController.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,28 @@ function Bump-AzVersion
$localAz = Import-PowerShellDataFile -Path "$PSScriptRoot\Az\Az.psd1"
Write-Host "Getting Az $ReleaseType information from gallery..." -ForegroundColor Yellow
if("LTS" -eq $ReleaseType){
$galleryAz = (Find-Module -Name Az -Repository $GalleryName -AllVersions | Where-Object {([System.Version]($_.Version)).Major%2 -eq 0} | Sort-Object {[System.Version]$_.Version} -Descending)[0]
}else{
$galleryAz = Find-Module -Name Az -Repository $GalleryName
if (Test-Path Env:\DEFAULT_PS_REPOSITORY_URL) {
Write-Host "Using DEFAULT_PS_REPOSITORY_NAME: $Env:DEFAULT_PS_REPOSITORY_NAME"
$AccessTokenSecureString = $env:SYSTEM_ACCESS_TOKEN | ConvertTo-SecureString -AsPlainText -Force
$credentialsObject = [pscredential]::new("ONEBRANCH_TOKEN", $AccessTokenSecureString)
$galleryAz = Find-PSResource -Name AzPreview -Repository $Env:DEFAULT_PS_REPOSITORY_NAME -Credential $credentialsObject -TrustRepository
}
else {
$galleryAz = Find-PSResource -Name AzPreview -Repository $GalleryName -Version *
}
$galleryAz = $galleryAz | Where-Object { ([System.Version]($_.Version)).Major%2 -eq 0 } | Sort-Object {[System.Version]$_.Version} -Descending
}
else
{
if (Test-Path Env:\DEFAULT_PS_REPOSITORY_URL) {
Write-Host "Using DEFAULT_PS_REPOSITORY_NAME: $Env:DEFAULT_PS_REPOSITORY_NAME"
$AccessTokenSecureString = $env:SYSTEM_ACCESS_TOKEN | ConvertTo-SecureString -AsPlainText -Force
$credentialsObject = [pscredential]::new("ONEBRANCH_TOKEN", $AccessTokenSecureString)
$galleryAz = Find-PSResource -Name AzPreview -Repository $Env:DEFAULT_PS_REPOSITORY_NAME -Credential $credentialsObject -TrustRepository
}
else {
$galleryAz = Find-PSResource -Name AzPreview -Repository $GalleryName
}
}

$versionBump = [PSVersion]::NONE
Expand Down Expand Up @@ -325,7 +344,15 @@ function Update-AzPreviewChangelog
$AzPreviewVersion = (Import-PowerShellDataFile "$PSScriptRoot\Az\Az.psd1").ModuleVersion
$localAz = Import-PowerShellDataFile -Path "$PSScriptRoot\AzPreview\AzPreview.psd1"
Write-Host "Getting gallery AzPreview information..." -ForegroundColor Yellow
$galleryAz = Find-Module -Name AzPreview -Repository $GalleryName
if (Test-Path Env:\DEFAULT_PS_REPOSITORY_URL) {
Write-Host "Using DEFAULT_PS_REPOSITORY_NAME: $Env:DEFAULT_PS_REPOSITORY_NAME"
$AccessTokenSecureString = $env:SYSTEM_ACCESS_TOKEN | ConvertTo-SecureString -AsPlainText -Force
$credentialsObject = [pscredential]::new("ONEBRANCH_TOKEN", $AccessTokenSecureString)
$galleryAz = Find-PSResource -Name AzPreview -Repository $Env:DEFAULT_PS_REPOSITORY_NAME -Credential $credentialsObject -TrustRepository
}
else {
$galleryAz = Find-PSResource -Name AzPreview -Repository $GalleryName
}
$updatedModules = @()
foreach ($localDependency in $localAz.RequiredModules)
{
Expand Down
Loading