Kiran Qureshi
Kiran Qureshi

Reputation: 1

Pass parameters to HTTP linked service in Azure Data Factory

my query is realted to HTTP linked service (LS) in Azure Data Factory. I have created a HTTP LS and have defined three int type parameters; date, month, and day. I have using 'add dynamic content' to fetch current day -1 day,month, date and trying to pass these to the HTTP link. Dynamic content formula for year: @int(substring(getPastTime(1,'Day'),0,4)) Dynamic content formula for month: @int(substring(getPastTime(1,'Day'),5,2)) Dynamic content formula for day: @int(substring(getPastTime(1,'Day'),8,2))

However, this is dynamic content is not working but if I manually pass on year, month and day, it seems to be working fine.

Please can someone idenity the problem with my dynamic content formula.

Upvotes: 0

Views: 1364

Answers (1)

Saideep Arikontham
Saideep Arikontham

Reputation: 6114

  • You cannot directly use dynamic content to assign values to parameters within the linked service. The static values would only work.
  • In order to use dynamic content, you need to pass the dynamic content from dataset to linked service or from pipeline activity to dataset and then to linked service.
  • The following is a demonstration where I have created 3 parameters similar to yours:

enter image description here

  • The URL I have used is as shown below (Using this would throw an error but the error would indicate that I will be successfully able to use these values):
https://jsonplaceholder.typicode.com/posts/@{linkedService().year}/@{linkedService().month}/@{linkedService().day}
  • I have passed the following values from dataset as shown below:
year : @substring(getPastTime(1,'Day'),0,4)
month : @substring(getPastTime(1,'Day'),5,2)
day : @substring(getPastTime(1,'Day'),8,2)
  • When I use this dataset as source in copy data activity, I get an error since URL is not valid. But you can see the URL is built as per dynamic content.

enter image description here

Upvotes: 0

Related Questions