From 6d8db1c611afe8f4c687969c23e872a1ec688653 Mon Sep 17 00:00:00 2001 From: Meera Ruxmohan <mruxmohan@microsoft.com> Date: Tue, 27 Aug 2024 13:29:40 -0700 Subject: [PATCH] Update azure-pipelines-official.yml for Azure Pipelines Use RM service connection and NuGet Authenticate for SlnGen.Corext package push --- azure-pipelines-official.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index ffa9779..70a1cf6 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -99,6 +99,28 @@ stages: publishFeedCredentials: 'NuGet-1ES-Full' condition: always() + - task: AzureCLI@2 + displayName: 'Push SlnGen.Corext' + inputs: + azureSubscription: 'CloudBuild-Push-v2' + scriptType: 'pscore' + scriptLocation: 'inlineScript' + inlineScript: | + # Get an access token for Azure DevOp (resource id is for AzDO) + $accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv + + # Set the access token as a secret, so it doesn't get leaked in the logs + Write-Host "##vso[task.setsecret]$accessToken" + + # Override the apitoken of the nuget service connection, for the duration of this stage + # Service connection is for "microsoft.slngen Official" + Write-Host "##vso[task.setendpoint id=d8767bc1-a109-4cb7-80c2-6ac1ebf4346e;field=authParameter;key=apitoken]$accessToken" + + - task: NuGetAuthenticate@1 + inputs: + forceReinstallCredentialProvider: true + nuGetServiceConnections: 'CloudBuild-Push' + - task: NuGetCommand@2 displayName: 'Push SlnGen.Corext' inputs: