one pipeline for DEV and QA

Vineet S 910 Reputation points
2024-09-25T15:05:02.0066667+00:00

Hi,

in order to run Copy activity in QA and Dev from one pipeline using following option

  • Adding a parameter called environment with possible values "dev" or "qa"
  • Creating variables for database name, server, etc.. and use expressions to set these based on the environment parameter
  • In your SQL dataset, use parameters for database name, server, etc.. and in your sink dataset, parameterize the file path if needed

How we can set variable based on (screenshot pls)

  • Creating variables for database name, server, etc.. and use expressions to set these based on the environment parameter

and how we can run this based on QA and DEV(screenshot apprciated)

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

Accepted answer
  1. Amira Bedhiafi 24,636 Reputation points
    2024-09-25T20:36:59.2666667+00:00

    You can create variables and use expressions to set their values based on the environment parameter ("dev" or "qa") using the following approach:

    1. Create an Environment Parameter:
      • Go to the pipeline in Azure Data Factory.
      • In the Parameters section, add a new parameter called environment. Set the possible values to "dev" and "qa".
    2. Create Variables for Server and Database:
      • In the Variables section, create variables such as ServerName and DatabaseName.
    3. Assign Values Based on the Environment Parameter:
      • In the pipeline's Set Variable activity, use expressions to set the values of ServerName and DatabaseName based on the environment parameter.
      • For example, for ServerName:
             
             @if(equals(pipeline().parameters.environment, 'dev'), 'dev-server-name', 'qa-server-name')
             
        
        Similarly, for DatabaseName:
             
             @if(equals(pipeline().parameters.environment, 'dev'), 'dev-database-name', 'qa-database-name')
             
        
    4. Use Variables in the SQL Dataset:
      • In your SQL dataset, parameterize the server name and database name.
      • In the Linked Service for the SQL dataset, bind the parameters to the variables you created earlier. You can pass the variable value using an expression like:
             
             @variables('ServerName')
             
        
        and
             
             @variables('DatabaseName')
             
        

    If you have any questions or need further explanation on any part, feel free to ask!


0 additional answers

Sort by: Most helpful

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.