How passing a global parameter to a linked service

pmscorca 1,052 Reputation points
2024-01-30T17:27:23.9+00:00

Hi, inside a Data Factory I've created database_name as a global parameter
User's image

and a linked service with a parameter
User's image

User's image

Now, how I could pass the database_name global parameter to the linked service? Thanks

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

Answer accepted by question author
  1. Amira Bedhiafi 41,111 Reputation points Volunteer Moderator
    2024-01-31T11:04:26.28+00:00

    To use the global parameter in your linked service, you'll need to modify the linked service's JSON definition where you replace the hardcoded database name with an expression that references your global parameter. You'll use the @ symbol to denote an expression. For example, if your linked service is connecting to an Azure SQL Database, and you want to use the global parameter for the database name, your linked service JSON might look something like this:

       {
         "name": "YourLinkedServiceName",
         "properties": {
           "type": "AzureSqlDatabase",
           "typeProperties": {
             "connectionString": {
               "type": "SecureString",
               "value": "Server=tcp:yourserver.database.windows.net,1433;Database=@{pipeline().globalParameters.database_name};..."
             }
           }
         }
       }
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. QuantumCache 20,676 Reputation points Moderator
    2024-02-09T08:12:33.86+00:00

    Hello @pmscorca

    Adding few more points to Amira's Response with ADF studio screenshots, thought it might be useful!!

    First create the Global Param, as you have already done that, just showing incase anyone need!!

    User's image

    In your pipeline, when you use the dataset, you can pass the global parameter value to the dataset parameter and then the dataset will pass the parameter to the Linked Service.

    Global Parameter-->Pipeline-->dataset-->Linked Service

    User's image

    Please do let us know if you have further questions in this matter.

    1 person found this answer helpful.

Your answer

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