Get bearer token for azure management api using data factory web activity

Raj D 616 Reputation points
2022-01-21T19:49:24.21+00:00

Hi, I am trying to use the Azure management api to GET pipeline run information for a data factory pipeline using Web Activity. To achieve this I am doing a POST to grab the bearer token using the details below.

URL:     https://login.microsoftonline.com/common/oauth2/authorize  
METHOD:  POST  
HEADERS: Content-Type = application/x-www-form-urlencoded  
BODY:    grant_type=client_credentials&client_id={id}&client_secret={secret}&resource=https://management.azure.com  

JSON Response:

{  
    "Response": "",  
    "ADFWebActivityResponseHeaders": {  
        "Pragma": "",  
        "Strict-Transport-Security": "",  
        "X-Content-Type-Options": "",  
        "X-Frame-Options": "",  
        "Link": "",  
        "X-DNS-Prefetch-Control": "",  
        "x-ms-request-id": "",  
        "x-ms-ests-server": "",  
        "Cache-Control": "",  
        "P3P": "",  
        "Set-Cookie": "",  
        "Date": "",  
        "Content-Length": "",  
        "Content-Type": "",  
        "Expires": ""  
    },  
    "effectiveIntegrationRuntime": "",  
    "executionDuration": 0,  
    "durationInQueue": {  
        "integrationRuntimeQueue": 1  
    },  
    "billingReference": {  
        "activityType": "",  
        "billableDuration": [  
            {  
                "meterType": "",  
                "duration": 0.1,  
                "unit": "Hours"  
            }  
        ]  
    }  
}  

I looked at the this example too. But, In my response I don't see anything related to token. Authentication is done using Service Principal. Am I missing something silly in here?

Thank you in advance.

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

Answer accepted by question author
  1. svijay-MSFT 5,256 Reputation points Microsoft Employee Moderator
    2022-01-24T08:57:55.76+00:00

    Hello @Raj D ,

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

    Can you please use the below URL and see whether this resolves your issue ?

    https://login.microsoftonline.com/<tenantid>/oauth2/token  
    

    instead of

    https://login.microsoftonline.com/common/oauth2/authorize  
    

    Then tenant id would be id of the tenant in which the app is registered. If I am not wrong, for service principal authentication - you will not be able provide common


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.