File tree Expand file tree Collapse file tree 2 files changed +28
-10
lines changed Expand file tree Collapse file tree 2 files changed +28
-10
lines changed Original file line number Diff line number Diff line change
1
+ parameters :
2
+ - name : deadPATServiceConnectionId # The GUID of the PAT-based service connection whose access token must be replaced.
3
+ type : string
4
+ - name : wifServiceConnectionName # The name of the WIF service connection to use to get the access token.
5
+ type : string
6
+ - name : resource # The scope for which the access token is requested.
7
+ type : string
8
+ default : 499b84ac-1321-427f-aa17-267ca6975798 # Azure Artifact feeds (any of them)
9
+
10
+ steps :
11
+ - task : AzureCLI@2
12
+ displayName : 🔏 Authenticate with WIF service connection
13
+ inputs :
14
+ azureSubscription : ${{ parameters.wifServiceConnectionName }}
15
+ scriptType : pscore
16
+ scriptLocation : inlineScript
17
+ inlineScript : |
18
+ $accessToken = az account get-access-token --query accessToken --resource '${{ parameters.resource }}' -o tsv
19
+ # Set the access token as a secret, so it doesn't get leaked in the logs
20
+ Write-Host "##vso[task.setsecret]$accessToken"
21
+ # Override the apitoken of the nuget service connection, for the duration of this stage
22
+ Write-Host "##vso[task.setendpoint id=${{ parameters.deadPATServiceConnectionId }};field=authParameter;key=apitoken]$accessToken"
Original file line number Diff line number Diff line change 82
82
displayName : Publish Nuget Packages to azure-publish
83
83
packagesToPush : $(Build.SourcesDirectory)/artifacts/$(BuildConfiguration)/packages/*.nupkg
84
84
packageParentPath : $(Build.SourcesDirectory)/artifacts/$(BuildConfiguration)/packages
85
- publishVstsFeed : DevDiv/vs-green
86
85
publishFeedCredentials : azure-public/vs-impl
87
86
allowPackageConflicts : true
88
87
nuGetFeedType : external
@@ -269,12 +268,9 @@ jobs:
269
268
!bin\Dlls\net472\Setup.dll
270
269
!SymStore\**
271
270
!VSSetup\Insertion\bootstrapper\**\vs_enterprise.exe
272
-
273
-
274
- # Authenticate with a service connection to be able to publish packages to external (different DevOps organization) NuGet feeds.
275
- # See: https://docs.microsoft.com/azure/devops/pipelines/tasks/package/nuget-authenticate?view=azure-devops
276
- # This connecction is used in the templateContext nuget outputs.
277
- - task : NuGetAuthenticate@1
278
- displayName : Authenticate NuGet
279
- inputs :
280
- nuGetServiceConnections : azure-public/vs-impl
271
+
272
+ - template : WIFtoPATauth.yml
273
+ parameters :
274
+ wifServiceConnectionName : azure-public/vside package push
275
+ deadPATServiceConnectionId : 207efd62-fd0f-43e7-aeae-17c4febcc660 # azure-public/vs-impl
276
+
You can’t perform that action at this time.
0 commit comments