diff --git a/eng/common/pipelines/templates/steps/validate-all-packages.yml b/eng/common/pipelines/templates/steps/validate-all-packages.yml index b2ba48e197b1..679d8830a459 100644 --- a/eng/common/pipelines/templates/steps/validate-all-packages.yml +++ b/eng/common/pipelines/templates/steps/validate-all-packages.yml @@ -16,7 +16,6 @@ steps: scriptType: pscore scriptLocation: inlineScript inlineScript: | - $accessToken = az account get-access-token --resource "499b84ac-1321-427f-aa17-267ca6975798" --query "accessToken" --output tsv $(Build.SourcesDirectory)/eng/common/scripts/Validate-All-Packages.ps1 ` -ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name) ` -ArtifactPath ${{ parameters.ArtifactPath }} ` @@ -25,7 +24,6 @@ steps: -ConfigFileDir '${{ parameters.ConfigFileDir }}' ` -BuildDefinition $(System.CollectionUri)$(System.TeamProject)/_build?definitionId=$(System.DefinitionId) ` -PipelineUrl $(System.CollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId) ` - -AccessToken $accessToken ` -IsReleaseBuild $$(SetAsReleaseBuild) workingDirectory: $(Pipeline.Workspace) displayName: Validate packages and update work items diff --git a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 index 0194c8f2e2a2..ee55d23274d7 100644 --- a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 +++ b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 @@ -5,17 +5,8 @@ $ReleaseDevOpsCommonParametersWithProject = $ReleaseDevOpsCommonParameters + @(" function Get-DevOpsRestHeaders() { - $headers = $null - $headerAccessToken = $null - if (Get-Variable -Name "accessToken" -ValueOnly -ErrorAction "Ignore") - { - $headerAccessToken = $accessToken - } - else - { - # Get a temp access token from the logged in az cli user for azure devops resource - $headerAccessToken = (az account get-access-token --resource "499b84ac-1321-427f-aa17-267ca6975798" --query "accessToken" --output tsv) - } + # Get a temp access token from the logged in az cli user for azure devops resource + $headerAccessToken = (az account get-access-token --resource "499b84ac-1321-427f-aa17-267ca6975798" --query "accessToken" --output tsv) if ([System.String]::IsNullOrEmpty($headerAccessToken)) { throw "Unable to create the DevOpsRestHeader due to access token being null or empy. The calling script needs to be pass an the accessToken value OR the calling script needs to be run in an azure authenticated environment." diff --git a/eng/common/scripts/Update-DevOps-Release-WorkItem.ps1 b/eng/common/scripts/Update-DevOps-Release-WorkItem.ps1 index 4cc06c568090..aa3f98860c4c 100644 --- a/eng/common/scripts/Update-DevOps-Release-WorkItem.ps1 +++ b/eng/common/scripts/Update-DevOps-Release-WorkItem.ps1 @@ -15,7 +15,6 @@ param( [string]$packageNewLibrary = "true", [string]$relatedWorkItemId = $null, [string]$tag = $null, - [string]$accessToken = $null, [bool]$inRelease = $true ) #Requires -Version 6.0 @@ -29,12 +28,10 @@ if (!(Get-Command az -ErrorAction SilentlyContinue)) { . (Join-Path $PSScriptRoot SemVer.ps1) . (Join-Path $PSScriptRoot Helpers DevOps-WorkItem-Helpers.ps1) -if (!$accessToken) { - az account show *> $null - if (!$?) { - Write-Host 'Running az login...' - az login *> $null - } +az account show *> $null +if (!$?) { + Write-Host 'Running az login...' + az login *> $null } az extension show -n azure-devops *> $null diff --git a/eng/common/scripts/Validate-All-Packages.ps1 b/eng/common/scripts/Validate-All-Packages.ps1 index 20c9ffba2436..f327c455291e 100644 --- a/eng/common/scripts/Validate-All-Packages.ps1 +++ b/eng/common/scripts/Validate-All-Packages.ps1 @@ -12,7 +12,6 @@ Param ( [string]$BuildDefinition, [string]$PipelineUrl, [string]$APIViewUri = "https://apiview.dev/AutoReview/GetReviewStatus", - [string]$AccessToken = $null, [bool] $IsReleaseBuild = $false ) @@ -33,8 +32,7 @@ function ProcessPackage($PackageName, $ConfigFileDir) -APIKey $APIKey ` -BuildDefinition $BuildDefinition ` -PipelineUrl $PipelineUrl ` - -ConfigFileDir $ConfigFileDir ` - -AccessToken $AccessToken + -ConfigFileDir $ConfigFileDir if ($LASTEXITCODE -ne 0) { Write-Error "Failed to validate package $PackageName" exit 1 diff --git a/eng/common/scripts/Validate-Package.ps1 b/eng/common/scripts/Validate-Package.ps1 index ee90752ad2e0..ee347e5da928 100644 --- a/eng/common/scripts/Validate-Package.ps1 +++ b/eng/common/scripts/Validate-Package.ps1 @@ -15,7 +15,6 @@ param ( [string] $BuildDefinition, [string] $PipelineUrl, [string] $APIViewUri, - [string] $AccessToken = $null, [bool] $IsReleaseBuild = $false ) Set-StrictMode -Version 3 @@ -24,12 +23,10 @@ Set-StrictMode -Version 3 . ${PSScriptRoot}\Helpers\ApiView-Helpers.ps1 . ${PSScriptRoot}\Helpers\DevOps-WorkItem-Helpers.ps1 -if (!$AccessToken) { - az account show *> $null - if (!$?) { - Write-Host 'Running az login...' - az login *> $null - } +az account show *> $null +if (!$?) { +Write-Host 'Running az login...' +az login *> $null } az extension show -n azure-devops *> $null @@ -171,8 +168,7 @@ function CreateUpdatePackageWorkItem($pkgInfo) -packageNewLibrary $pkgInfo.IsNewSDK ` -serviceName "unknown" ` -packageDisplayName "unknown" ` - -inRelease $IsReleaseBuild ` - -accessToken $AccessToken + -inRelease $IsReleaseBuild if ($LASTEXITCODE -ne 0) {