Last active
July 5, 2023 19:40
-
-
Save gxara/24cbf917996fcb2c633c0804f81f5401 to your computer and use it in GitHub Desktop.
Setup azure devops env vars from CSV
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
printf "\n\n**** Setting up AZ DEVOPS env vars *****\n\n" | |
az login | |
read -p "- Type the project name: " PROJECT | |
read -p "- Type the group name: " GROUP_NAME | |
read -p "- Type the name of the comma separated file with envs and values: " FILE_NAME | |
az devops configure -d project=$PROJECT | |
GROUP_ID=$(az pipelines variable-group list --group-name $GROUP_NAME --query '[0].id') | |
awk -v GROUP_ID=$GROUP_ID -v PROJECT=$PROJECT --field-separator="," '{ print "az pipelines variable-group variable create --group-id ",GROUP_ID," --project",PROJECT," --name ",$1,"--value ",$2,";" }' $FILE_NAME >> command.sh | |
printf "\n**** Done! Commands saved at commands.sh****\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment