How to connect to API from Synapse or data factory pipeline

Deba Nayak 61 Reputation points
2022-12-20T15:51:00.05+00:00

Hi,

I am trying to connect to an API end point (hosted on Azure). I am able to make the connection by passing the bearer token and subscription key manually. Now I am trying to automate the process. I am able to generate the Bearer Token and wondering how to populate the subscription key as well from the pipeline. I am using the client ID and Client secret for generating the Token.

Is there another method where I don't have to pass the subscription key in the request header?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,447 questions
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,373 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MartinJaffer-MSFT 26,236 Reputation points
    2022-12-28T20:04:10.243+00:00

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

    If I understand correctly, you are using OAuth2 authentication. You are currently able to get a Bearer token for it using a Web activity, and want to use it in Copy Activity. As you mentioned API end point, I expect you are either using HTTP connector or REST connector. Your ask is how to assemble these together.

    You may want to use "Secure output" and/or "secure input" found in activity General tab, so the credentials do not get included in logs.
    If you put a connection / dependency from the token-generating activity to the copy activity, you can then do like @activity('GetTokenActivity').output.myTokenProperty in the appropriate place to fetch the token.

    Also, if you are using the REST connector, the REST Linked service has the OAuth2 authentication option, which should eliminate the need to do a separate Web activity for the token.

    The HTTP Linked service does not have the same Authentication options as REST Linked service.

    Have I understood your ask correctly?

    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.
    0 comments No comments

  2. Deba Nayak 61 Reputation points
    2023-01-02T08:51:15.387+00:00

    Hi @MartinJaffer-MSFT ,
    Thanks for your response. I am doing exactly what you mentioned. Currently, I have to pass the "Ocp-Apim-Subscription-Key" mandatorily, which I am doing manually in a parameter. Please suggest a method to automatically populate the subscription key parameter or a different authentication method where I can skip the subscription key altogether.

    Sorry if I was not very clear.

    Regards,
    Deba


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.