Variable Inside Specific Pipeline
Go to Pipeline at the sidebar > choose pipeline
At the top side of the screen, click Edit.
Click on the Variable button located at the top right of the screen.
- Click on the cross button to add new variable. Fill in the name and value.
Note:
To reference a variable in YAML, prefix it with a dollar sign and enclose it in parentheses. For example: $(variable-name) To use a variable in a script, use environment variable syntax. Replace . and space with _, capitalize the letters, and then use your platform's syntax for referencing an environment variable. Examples: Batch script: %VARIABLE-NAME% PowerShell script: ${env:VARIABLE-NAME} Bash script: $(VARIABLE-NAME)
- All the list of variables that you customized will be listed on the side bar
- This is now avaiable for use in the pipeline file.
Create Azure Variable Group that is Accessble for All Pipelines
Go to Library at the sidebar
Click on the
- Variable Group
Fill in the Variable Group name, description, toggle link secrets, and Add variables
Here is the sample yml content where I placed the variable group and individual variable
- script: |
doppler run -p $(projectVariable) -c <environmentVariable> --command "node generateEnv.cjs"
displayName: 'Generate Environments'
env:
DOPPLER_TOKEN: $(TOKEN_DEV)