Last active
August 16, 2024 13:32
-
-
Save johlju/0165cce89f6a9ae2d22ae413fa3c6548 to your computer and use it in GitHub Desktop.
DSC Community: Update GitHub PAT on Azure Pipelines
This file contains hidden or 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
# Prerequisites: | |
# | |
# Install Azure CLI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli | |
winget install --id Microsoft.AzureCLI | |
# restart console prompt | |
# Install AzureDevOps extension | |
az extension add --name azure-devops | |
# Install 1Password CLI: https://developer.1password.com/docs/cli/get-started | |
winget install 1password-cli | |
# restart console prompt | |
# 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 (this hopefully gives the tenant ID): | |
az login --allow-no-subscriptions | |
# ...then you might be required to login using this | |
az login --tenant <tenant_ID> --allow-no-subscriptions | |
# Then run this to get the PAT from 1Password (or another command to get it wherever it is). | |
$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