Error getting authentication to Azure data factory - rest

I need to hit the data factory pipeline with the REST call ...
So, I
Registered application in the Azure Active Directory.
Obtained Client_ID and client_Secret
Then I try to use Postman to get the authentication token and get an error, which I do not understand. Please, help. How can I get authentication token to my ADF using Postman ?

In body section, instead of raw, use - x-www-form-urlencoded as below and it should help resolve the issue.
Ideally, when you select x-www-form-urlencoded radio button in the Body section, it automatically sets the Content-Type=application/x-www-form-urlencoded under the Headers tab as shown below.

Please follow below steps for generating bearer token In ADF :
Step 1: Create a web activity to get the Access Token from ADF.
URL: https://login.microsoftonline.com/<Tenant ID>/oauth2/token
Method : POST
Body: grant_type=client_credentials&client_id=<client_id>&client_secret=<client_secret>&resource=https://management.azure.com/
Header: Content-Type:application/x-www-form-urlencoded
Step2: Create Set variable :
Add dynamic content -> #activity('Web1').output.access_token
Pipeline successfully executed and got the token

Related

Azure Data Factory - Web activity with header value containing comma failing

We are trying to ingest data from Amazon Selling Partner API. We currently have an azure function that signs our request and returns the header values. The authorization header contains commas in it and the comma causes the activity to fail on the client side.
Here is an exampleof the authorization header:
AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request,SignedHeaders=date;host;x-amz-content-sha256;x-amz-date;x-amz-storage-class,Signature=98ad721746da40c64f1a55b78f14c238d841ea1380cd77a1b5971af0ece108bd
To reproduce, create a new pipeline and add a web activity. Enter "http://www.google.com" for the url with the method GET. Add a header like above.
You should get the following error:
Error calling the endpoint 'http://www.google.com'. Response status code: 'NA - Unknown'. More details: Exception message: 'NA - Unknown [ClientSideException] The format of value 'AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request,SignedHeaders=date;host;x-amz-content-sha256;x-amz-date;x-amz-storage-class,Signature=98ad721746da40c64f1a55b78f14c238d841ea1380cd77a1b5971af0ece108bd' is invalid.'.
Request didn't reach the server from the client. This could happen because of an underlying issue such as network connectivity, a DNS failure, a server certificate validation or a timeout.
Any work arounds for this?
Thanks,
Scott
If you are using Authorization as a header to get data make sure to use bearer in front of the Token.
Authorization Bearer < Access Token >
I tried to reproduce the same in my environment and got below results:
Output:
For more information refer this SO thread .

ADF Web activity get access token with Post API using System Assigned managed identity

I want to use ADF , web activity to get the access token from
https://login.windows.net/**********/oauth2/token
using the system assigned managed identity from ADF
resource is
https://purview.azure.net
How is the request body should be ? how is the header should be ?
Please follow below steps:
Step 1: Create a web activity to get the Access Token from ADF
Add your URL: https://login..../<Tenant ID>/oauth2/token
Method : POST
Body: grant_type=client_credentials&client_id=<client_id>&client_secret=<client_secret>&resource=https://purview.azure.net/
Header: Content-Type:application/x-www-form-urlencoded
Authentication: System Assigned Managed Identity
Resource: https://purview.azure.net/
Step2: Create Set variable :
Add dynamic content -> #activity('Web1').output.access_token
Response

REST API calls through Pentaho Data Integration (Spoon)

Hello Pentaho Experts,
I am attempting to make a REST API call through REST Client in Pentaho. I have a Api key for authentication. I tried it in Postman, and it works perfectly fine, but Pentaho throws 403 status code. Below is the postman screenshot:
My Pentaho transformation contains two steps. I am passing URL through "Generate Rows" step and then adding Key and Value in the Header:
Generate Rows:
Rest Client (General):
Rest Client (Header):
Any idea what I might be missing here? Expected output is JSON.
I can't speak to the use of passing key/value in Header for authentication, but what has worked for me is to use the Authentication tab to input my credentials or passing an Authentication header with a bearer token.
Authentication Tab:
I use this method to generate and return a bearer token from the API. The token is then used as the authentication method in subsequent steps. The "body" includes the scope (i.e.: "reports:read") and grant type ("client_credentials"). The "header" contains the value "application/x-www-form-urlencoded".
Authentication Header:
Once a token has been returned from the API, this can be provided in an "authorization" header. Prepend "bearer" to the token value and pass this in the header tab.
I would also recommend looking at the Headers being passed in Postman to ensure you are not missing anything else that might be happening in your call.

How to add Oauth Bearer token in QTP

I'm working on HP UFT Rest API Testing where i need to Pass "Authorization : Bearer " to perform or execute the Rest Service request then only my service will execute and displays the response.
Can any one give me the solutions,How to add Oauth Bearer token in QTP for Rest API Testing.
Please refere below link :
https://admhelp.microfocus.com/uft/en/14.03/UFT_Help/Content/User_Guide/task_API_coding_manipulate_WSC_properties.htm
There will be methods associated with the every block/methods , you can write C# code to append the string to the output of authorization operation and store in a global variable- that can be passed as a input to subsequent operation.
BeforeMethod , aftermethods are some of Event Handlers that are assosicated with each operation.

How to call REST API related to Azure Search through postman?

I am trying to call REST API related to Azure Search through postman.
Here is the API link: (Check Step 1: Create a data source)
https://learn.microsoft.com/en-us/azure/search/search-howto-indexing-azure-blob-storage
Have sent parameter api-key: [admin key] in form-data and other through jSON object.
I am getting 403 error.
Whats the correct way to get required output?
Update :
Changed position of api-key. Still getting the error as :
Is there any additional setting for postman to work with Azure's REST APIs?
Please make sure that you pass api-key in Headers instead of form-data and also all the headers should be selected. Once you do that, things should work just fine.