forked from xamarin/xamarin-macios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor steps to set the AzDO.BearerToken variable into a shared tem…
…plate
- Loading branch information
1 parent
ad2c0be
commit 62fdab7
Showing
3 changed files
with
29 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Sets the AzDO.BearerToken variable that can be used as the auth token to disable/reenable agents | ||
steps: | ||
- template: azure-tools/az-client-update.yml@templates # AzureCLI step below requires that AzClient 2.x is installed on the agent | ||
parameters: | ||
platform: 'All' # Update Az tools for both Windows and Mac agents | ||
version: '2.62.0' | ||
|
||
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-security-configuration/configuration-guides/pat-burndown-guidance#authentication-from-pipelines | ||
# Requires Azure client 2.x | ||
- task: AzureCLI@2 | ||
displayName: 'AzDO.BearerToken based on service connection' | ||
enabled: true | ||
inputs: | ||
azureSubscription: 'DevDiv - SharedUntrustedAgentPool-Manage' | ||
scriptType: 'pscore' | ||
scriptLocation: 'inlineScript' | ||
inlineScript: | | ||
# if this fails, check out this bash script that includes diagnostics: | ||
# https://gist.github.com/johnterickson/19f80a3e969e39f1000d118739176e62 | ||
# Note that the resource is specified to limit the token to Azure DevOps | ||
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv | ||
Write-Host "Setting AzDO.BearerToken" | ||
Write-Host "##vso[task.setvariable variable=AzDO.BearerToken;issecret=true]${token}" |