Variable from one environment to another

Vineet S 750 Reputation points
2024-09-05T22:23:39.84+00:00

Hi how to add environment variable when same pipeline needs to load from qa to prod or test instance like link services.. Pls share screenshot

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

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 23,096 Reputation points
    2024-09-06T10:31:01.0933333+00:00

    You can use parameterization with environment-specific settings in the pipeline :

    1. Create Pipeline Parameters:
      • In Azure Data Factory, open the pipeline you want to configure.
      • Under the Pipeline pane, click Parameters.
      • Add a new parameter that will store the environment-specific variable, such as ServiceUrl.
    2. Configure Pipeline Activities:
      • In the activity (e.g., a web activity or linked service), find the property that needs to be parameterized.
      • Set the property to the parameter created earlier using dynamic content, e.g., @pipeline().parameters.ServiceUrl.
    3. Set Variable Values Per Environment (QA, PROD, TEST):
      • Navigate to ManageTriggers.
      • Create environment-specific triggers (e.g., one for QA, one for PROD).
      • Each trigger should pass the appropriate value for the parameter using the Pipeline Parameters section. For example, when the QA trigger runs, the parameter ServiceUrl is set to https://qa.example.com/api, and for PROD, it is https://prod.example.com/api.
    4. Create Global Parameters (Optional):
      • Navigate to ManageGlobal Parameters.
      • Add parameters here if they are needed across multiple pipelines for each environment.
    5. Linked Service Parameterization (Optional):
      • If your variable is linked to a service (like a database or storage account), open the linked service in the Manage pane.
      • Under Connection String or other configurable properties, use parameters or dynamic content to make the service URL or credentials environment-specific.
      • For example, use @pipeline().parameters.ServiceUrl or @dataset().connectionString to parameterize the linked service.
    6. Publish and Deploy:
      • Once your pipeline is parameterized, publish it to your data factory.
      • When moving from one environment to another (e.g., from QA to PROD), you can modify the values in the respective triggers to ensure they match the new environment.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.