@@ -176,9 +176,28 @@ function Bump-AzVersion
176
176
$localAz = Import-PowerShellDataFile - Path " $PSScriptRoot \Az\Az.psd1"
177
177
Write-Host " Getting Az $ReleaseType information from gallery..." - ForegroundColor Yellow
178
178
if (" LTS" -eq $ReleaseType ){
179
- $galleryAz = (Find-Module - Name Az - Repository $GalleryName - AllVersions | Where-Object {([System.Version ]($_.Version )).Major% 2 -eq 0 } | Sort-Object {[System.Version ]$_.Version } - Descending)[0 ]
180
- }else {
181
- $galleryAz = Find-Module - Name Az - Repository $GalleryName
179
+ if (Test-Path Env:\DEFAULT_PS_REPOSITORY_URL) {
180
+ Write-Host " Using DEFAULT_PS_REPOSITORY_NAME: $Env: DEFAULT_PS_REPOSITORY_NAME "
181
+ $AccessTokenSecureString = $env: SYSTEM_ACCESS_TOKEN | ConvertTo-SecureString - AsPlainText - Force
182
+ $credentialsObject = [pscredential ]::new(" ONEBRANCH_TOKEN" , $AccessTokenSecureString )
183
+ $galleryAz = Find-PSResource - Name AzPreview - Repository $Env: DEFAULT_PS_REPOSITORY_NAME - Credential $credentialsObject - TrustRepository
184
+ }
185
+ else {
186
+ $galleryAz = Find-PSResource - Name AzPreview - Repository $GalleryName - Version *
187
+ }
188
+ $galleryAz = $galleryAz | Where-Object { ([System.Version ]($_.Version )).Major% 2 -eq 0 } | Sort-Object {[System.Version ]$_.Version } - Descending
189
+ }
190
+ else
191
+ {
192
+ if (Test-Path Env:\DEFAULT_PS_REPOSITORY_URL) {
193
+ Write-Host " Using DEFAULT_PS_REPOSITORY_NAME: $Env: DEFAULT_PS_REPOSITORY_NAME "
194
+ $AccessTokenSecureString = $env: SYSTEM_ACCESS_TOKEN | ConvertTo-SecureString - AsPlainText - Force
195
+ $credentialsObject = [pscredential ]::new(" ONEBRANCH_TOKEN" , $AccessTokenSecureString )
196
+ $galleryAz = Find-PSResource - Name AzPreview - Repository $Env: DEFAULT_PS_REPOSITORY_NAME - Credential $credentialsObject - TrustRepository
197
+ }
198
+ else {
199
+ $galleryAz = Find-PSResource - Name AzPreview - Repository $GalleryName
200
+ }
182
201
}
183
202
184
203
$versionBump = [PSVersion ]::NONE
@@ -325,7 +344,15 @@ function Update-AzPreviewChangelog
325
344
$AzPreviewVersion = (Import-PowerShellDataFile " $PSScriptRoot \Az\Az.psd1" ).ModuleVersion
326
345
$localAz = Import-PowerShellDataFile - Path " $PSScriptRoot \AzPreview\AzPreview.psd1"
327
346
Write-Host " Getting gallery AzPreview information..." - ForegroundColor Yellow
328
- $galleryAz = Find-Module - Name AzPreview - Repository $GalleryName
347
+ if (Test-Path Env:\DEFAULT_PS_REPOSITORY_URL) {
348
+ Write-Host " Using DEFAULT_PS_REPOSITORY_NAME: $Env: DEFAULT_PS_REPOSITORY_NAME "
349
+ $AccessTokenSecureString = $env: SYSTEM_ACCESS_TOKEN | ConvertTo-SecureString - AsPlainText - Force
350
+ $credentialsObject = [pscredential ]::new(" ONEBRANCH_TOKEN" , $AccessTokenSecureString )
351
+ $galleryAz = Find-PSResource - Name AzPreview - Repository $Env: DEFAULT_PS_REPOSITORY_NAME - Credential $credentialsObject - TrustRepository
352
+ }
353
+ else {
354
+ $galleryAz = Find-PSResource - Name AzPreview - Repository $GalleryName
355
+ }
329
356
$updatedModules = @ ()
330
357
foreach ($localDependency in $localAz.RequiredModules )
331
358
{
0 commit comments