ADF OAuth2 Client Credentials Flow - Connection Test Fails

Pravalika-randstad 240 Reputation points
2024-04-11T08:10:39.3+00:00

I'm trying to connect to a REST service requiring an access token (OAuth2) using Azure Data Factory (ADF).

In Postman, everything works perfectly with the client credentials flow (client_id/client_secret):

  • I call the token endpoint to get an access token.
  • I use that token in a subsequent request to retrieve data.

However, when I configure a linked service in ADF to use the same client credentials flow, the connection test fails with the error message "The request body must contain the following parameter: 'client_secret'."

I'm confused because the client_secret is supposed to be included in the request body for the client credentials flow. Is there a configuration I'm missing in ADF? As a temporary workaround, I'm using a Web Activity.

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

Accepted answer
  1. Smaran Thoomu 24,110 Reputation points Microsoft External Staff Moderator
    2024-04-11T08:49:24.7533333+00:00

    Hi @Pravalika-randstad

    Thanks for the question and using MS Q&A platform.

    It seems you're having trouble connecting to a REST service that needs an access token (OAuth2) using Azure Data Factory.

    From the error message, it looks like the request body is missing the 'client_secret' parameter, which is needed for the client credentials flow. Make sure to include it in the request body. Also, check if 'Allow public client flows' is disabled for the Azure AD application. Enabling it might fix the issue.

    User's image

    You can find more details in these links:

    Also, review the linked service configuration in Azure Data Factory to ensure the 'client_secret' is included and correct. Here's a guide on parameterizing linked services: https://docs.microsoft.com/en-us/azure/data-factory/parameterize-linked-services?tabs=data-factory

    If the problem persists, you can try using the Web Activity as a temporary solution, as you mentioned.

    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.


0 additional answers

Sort by: Most helpful

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.