Global Variable and Global Parameter use cases

Samy Abdul 3,366 Reputation points
2021-09-15T07:08:46.307+00:00

I understand there are System variable, user defined variable and environment variable. And the scope of the variable could be

modified during the runtime unlike Parameters. But Global Parameters can be set it from the parameters tab within Manage tab, but for Global variable as per below documentation it needs to be defined at YAML

"https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch
Variable scopes

In the YAML file, you can set a variable at various scopes:

• At the root level, to make it available to all jobs in the pipeline.

• At the stage level, to make it available only to a specific stage.

• At the job level, to make it available only to a specific job.

When a variable is defined at the top of a YAML, it will be available to all jobs and stages in the pipeline and is a global variable. Global

variables defined in a YAML are not visible in the pipeline settings UI.

Variables at the job level override variables at the root and stage level. Variables at the stage level override variables at the root level."

Is there anyway or workaround that, we could explicitly define Global variable in ADF and what actually is the use case for this?

Appreciate your inputs a lot. Thank you.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,483 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MartinJaffer-MSFT 26,011 Reputation points
    2021-09-15T21:47:37.437+00:00

    Hello @Samy Abdul and welcome to Microsoft Q&A.

    I feel there is some degree of confusion among whether a variable belongs to the devops pipeline , or the Data Factory pipeline. There are many words being overloaded here. While devops and DataFactory both use the words "pipeline" and "variable" and "global", they are not the same.

    In Azure Data Factory, a Global Variable, is a key-value pair made available in the context of all ADF pipelines in that Factory. Any activity can have a Dynamic Expression which makes use of the Global Variable. The activity can make use of the Global Variable, including passing the value down to a parameterized Dataset, and the Dataset pass it down to a parameterized Link Service.

    The devops variables and parameters are used mostly in devops. The only way they can touch upon Data Factory, is during the deployment process. An ARM template can have parameters. Devops can provide values for the template parameters. Most commonly, this is used to point a linked service to the correct resource / environment, such as having a test database separate from a production database.

    How the ARM template is parameterized determines what can change in the Data Factory during deployment. I think Data Factory Global Variables can fall under this category.

    Does this help or make sense?