Skip to content

Instantly share code, notes, and snippets.

@johlju
Last active August 20, 2023 07:22
Show Gist options
  • Save johlju/0165cce89f6a9ae2d22ae413fa3c6548 to your computer and use it in GitHub Desktop.
Save johlju/0165cce89f6a9ae2d22ae413fa3c6548 to your computer and use it in GitHub Desktop.
DSC Community: Update GitHub PAT on Azure Pipelines
# Prerequisites:
#
# Install Azure CLI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
# Install AzureDevOps extension: az extension add --name azure-devops
# Install 1Password CLI: https://developer.1password.com/docs/cli/get-started
# save the raw script in a temporary location: https://gist.github.com/johlju/c7be5816c52c9aff7b4a00ff01d435a8
Invoke-WebRequest -Uri 'https://gist.githubusercontent.com/johlju/c7be5816c52c9aff7b4a00ff01d435a8/raw/d73ea890b03af12de6b9dd174f5af6e08abe760d/AutomateSettingGitHubPAT.ps1' -OutFile 'AutomateSettingGitHubPAT.ps1'
# Login with the account that access DSC Community pipelines:
az login --allow-no-subscriptions
# Then run this to get the PAT from 1Password.
$PAT = op item get "<change to 1Password item name>" --fields label=password
# Run this script and pass the PAT in the parameter.
./AutomateSettingGitHubPAT.ps1 -PAT $PAT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment