-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update publishing pipelines to use federated credentials inste…
…ad of PATs and client secrets (#2082) #### Details Our release pipelines for the ADO extension utilize a Visual Studio Marketplace Service Connection with a PAT to publish to the Visual Studio Marketplace. This PR creates a new template task (`generate-vs-marketplace-token.yaml`) that uses AzureCLI to generate an access token for that service connection to use instead. This template is then used directly before the tasks that involve the VS Marketplace SC (the `QueryVersion` task in `package-vsix-file.yaml` and the `PublishAzureDevOpsExtension` task in `publish-vsix-file.yaml`). Additionally, this PR implements the new ESRP signing task that uses managed identity with federated credentials instead of client secrets to authenticate. It also deletes the yaml file for the pipeline that creates a new ESRP service connection since that type of service connection is no longer used in the signing task and we won't need to regenerate the entire SC during secret rotation anymore. ##### Motivation Security improvements ##### Context This solution for removing PAT usage in the VS Marketplace Publishing step was based on [this workflow](https://jessehouwing.net/publish-azure-devops-extensions-using-workload-identity-oidc/), linked from [this issue](microsoft/azure-devops-extension-tasks#506) in microsoft/azure-devops-extension-tasks. These changes coincide with the addition of the following new variables to the pipeline in ADO (documenting here in case they ever need to be changed): `linuxImage`: the name of the linux image in the hosted pool to be used for this pipeline (currently set to `ubuntu-22.04-secure`) `MARKETPLACE_RESOURCE_ID`: the resource ID of the VS Marketplace SC `esrp-app-registration-client-id`: the client ID of the ESRP Signing app registration `esrp-app-registration-tenant-id`: the tenant where the ESRP Signing app registration lives #### Pull request checklist <!-- If a checklist item is not applicable to this change, write "n/a" in the checkbox --> - [n/a] Addresses an existing issue: Fixes #0000 - [n/a] Added relevant unit test for your changes. (`yarn test`) - [n/a] Verified code coverage for the changes made. Check coverage report at: `<rootDir>/test-results/unit/coverage` - [x] Ran precheckin (`yarn precheckin`)
- Loading branch information
1 parent
5aafc72
commit 47c93b1
Showing
7 changed files
with
41 additions
and
133 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
steps: | ||
- task: AzureCLI@2 | ||
displayName: Get accessToken | ||
name: getAccessToken | ||
inputs: | ||
azureSubscription: a11y-insights-action-prod | ||
scriptType: pscore | ||
scriptLocation: 'inlineScript' | ||
## The guid after --resource in the following command maps to the Azure DevOps Services | ||
## REST API (https://learn.microsoft.com/en-us/rest/api/azure/devops/tokens/) | ||
inlineScript: | | ||
$accessToken = az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query "accessToken" --output tsv | ||
write-host "##vso[task.setsecret]$accessToken" | ||
write-host "##vso[task.setendpoint id=$(MARKETPLACE_RESOURCE_ID);field=authParameter;key=password]$accessToken" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters