How do I add header with token in Azure Data Factory

Magnus 26 Reputation points
2022-03-03T12:40:03.173+00:00

Hi!

I'm trying to connect to a GraphQL api with the http connector in Azure Data Factory. GraphQL wants a header in this format:

Authorization: token xxxxxxxxxxxxx

How do I add that header?

/Magnus

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

3 answers

Sort by: Most helpful
  1. MartinJaffer-MSFT 26,036 Reputation points
    2022-03-07T21:05:47.753+00:00

    Hello @Magnus ,
    Thanks for the question and using MS Q&A platform.

    As we understand the ask here is how to add the authorization header when using http connector . Note, usually I see Authorization: Bearer XXXX not Authorization: token XXXX. Please double check which one it should be in your case.

    1. Open the dataset, and add a parameter. In this example I can calling it tokenparam.
    2. In the Additional Headers textbox enter the following dynamic content: @markus.bohland@hotmail.de ('Authorization: token ',dataset().tokenparam)
    3. Go to the copy activity and find the new place to enter parameter value. Reference wherever you are getting the token value from.

    Please do let me if you have any queries.

    Thanks
    Martin


    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
      • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

  2. Magnus 26 Reputation points
    2022-03-09T08:00:47.387+00:00

    Sorry for the last post. It returns "Invalid json syntax". If I haven't published a pipeline is there any way in ADF to see what is returned when Previewing data?


  3. Magnus 26 Reputation points
    2022-05-12T08:13:19.413+00:00

    I solved this, sorry for late reply all.

    First of all I moved the authorization to the Linked service

    201300-linked.png

    Then I created a Json dataset and connected it to the Linked service.

    Added a Copy Data in the pipeline and set the properties to this

    201323-copy.png

    What's really really important here is the formatting of the GraphQL in the Request Body. The data has to be on one line, no line breaks. The spacing is also very important to get it to work.

    Hope this helped someone.

    0 comments No comments