Thursday 24 September 2020

Using global parameters in Azure Data Factory

Case
In a previous blogpost we described how to use the Azure Keyvault to parameterize some properties in Azure Data Factory (ADF) pipelines. Although that worked technically very well, it’s not always preferable to store non-sensitive data in the keyvault.

With the arrival of global parameters in Data Factory it’s now possible to parameterize a property in ADF pipelines without the use of keyvault. You can use this parameter in all the pipelines in the ADF environment. In this weblog we will explain how to create and use those global parameters. 
Data Factory Global parameters










Solution
We are going to create a global parameter to upscale an Azure SQL database with a Web activity via its RestAPI. For more in depth information about up and down scaling read the blogpost: up/down scale Azure DB

1) Creating a global parameter
The following steps describes how to create a global parameter
  • Go to ‘manage’ in the left menu (Suitcase with wrench icon)
  • Then click on ‘Global parameters’
  • Click on ‘New’ 
  • Now you can fill in the name, type and the value.
    Please note that you can not use  ‘-‘ in the parameter name but you can use the ‘_’ you will receive an errorcode "{"code":"BadRequest","message":"ErrorCode=InvalidTemplate, ErrorMessage=The expression 'pipeline().globalParameters.myparam-dbtest-url' is not valid: the string character 'd' at position '35' is not expected}
  • Click on Save
Global parameters











In this example we used a global parameter to store the RestAPI URL of an Azure SQL Database. This URL will be different for each environment of the DTAP-street.

Adding Global parameter














2) Using a global parameter
The next step is to use the global parameter in a pipeline. In this example we used the Web activity and the Global parameter will make the URL property dynamic.
  • Go to the pipeline
  • Go to the Web activity
  • Go to the settings tab
  • Click on the URL textbox and then on ‘Add Dynamic content’
  • On the right side scroll down till you see the ‘Global parameters’, here you will find all your global parameters, in our example you will see the database url parameter.
  • Click on the name, and that’s it 

Using global parameter











Conclusion
In this weblog we showed you how to create and use a global parameter. This parameter can only be used in the pipeline and it’s not possible to use them in e.g. Linked services or Triggers. In an upcoming post we will explain how to use these global parameters when deploying ADF to another environment with Azure DevOps.