Variables is the adf pipeline provide the functionality to temporary hold the values. They are used for similar reason like we do use variables in the programming language. They are available inside the pipeline and there is set inside the pipeline.
Set Variable and append variable are two type of activities used for the setting or manipulating the variables values.
There are two types of the variable :
System variable: These are some kind of the fixed variable from the azure pipeline itself. For example pipeline name, pipeline id, trigger name etc. You mostly need this to get the system information which might be needed in your use case.
You can also use them directly by clicking on add dynamic content A text window will appear and then you can use from drop down directly.
Once you click on variable name from below they will automatically inserted in the dynamic content box. Like this :
User variable : User variable is something which you declared manually based on your logic of the pipeline. For creating the variable you go the pipeline and under the variable tab click on + sign to add variable.
variable can be of three type. You decide based on your need. You can also provide the default value as per you need.
Variable types :
Array, boolean String.
Once the variable has been declared you can use them using :
Set variable Activity :
Provide the activity name and click on variable tab it will look like this :
It will ask you to select the variable from the drop down. Once you select the variable from drop down, a another text box appear to set the value :
Now in the value section you can add the fixed value or the dynamic content based on your need.
For example in below I am trying to set the variable as trigger runtime.
This is how I can access variable value in the activity :
Summary : Variables in adf pipelines are used to hold the temporary values and intended to be used within the pipeline. You can use set variable and append variable activity to manipulate the variable value.