How to add Auth Headers in REST Linked Service in Azure Data Factory (ADF) when using oAuth2 Client Credentials?

Eduardo Moralles 0 Reputation points
2024-03-28T18:18:03.04+00:00

My API provider requires an API-Key additional header when using oAuth2 Client Credential to generate access token.

In Azure DataFactory, when I create a REST linked service using OAuth2 Client Credential as authentication type, I also include Auth Header in order to send API-Key header in auth request.

User's image

But it seams Data Factory ignores this additional Auth Header, as the error messages indicates me when testing this connection. This similar request works OK when using PostMan.

User's image

What should I change to get this working?

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

1 answer

Sort by: Most helpful
  1. Harishga 3,345 Reputation points Microsoft Vendor
    2024-03-29T08:08:02.55+00:00

    Hi @Eduardo Moralles

    Welcome to Microsoft Q&A platform and thanks for posting your question here.

    As per REST connector documentation, authenticationType supported are Anonymous, Basic, AadServicePrincipal, and ManagedServiceIdentity. User-based OAuth isn't supported. Click here to know more about same. But linked service configuration details shows OAuth authentication as well.
    User's image

    As a worked we can consider using Web activity to make API call and get Bearer token and then take token from web activity output json and pass it to main API call to do our desired work. Kindly check below link where similar work-around discussion happened. https://learn.microsoft.com/en-us/answers/questions/52665/how-can-we-authenticate-rest-api-endpoint-via-api.html

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.