Azure function using hybrid connection - azure

I have an azure function which is supposed to call an on-prem API. The application works fine in my dev environment. But there is a problem when I deployed it to Azure. I have already set up a hybrid connection for my Azure function to connect to the on-prem server. But when I run the code to get a response from on-prem API I get a 204 error. I believe there is a problem with the connection to on-prem from Azure. Could you review my setting and advice if anything is wrong?
My Code:
var request = new RestRequest("**https://onPremServer.internal.myDomain.com:534**/api/token", Method.Post);

204 status code its not an Error. its successfully request and response.
200-206 status code its show successfully. and 204 status code show its not content return by the API. Its Api return content. You can change content from API Side.
The 204 (No Content) status code indicates that the server has
successfully fulfilled the request and that there is no additional
content to send in the response payload body.
204 status No Content by Apihandyman site.
Azure Functions Using Hybrid Connections by stefanroth.

Related

Webhook validation handshake failed

i'm new in azure and wanted to create an Event subscription to push any changes (here resource write success) from my blob storage to my Logic App via HTTP. In my Logic app i have a When a HTTP request is received, which would run when i send a request.
just wanted to demonstrate how i'm trying to create it.
NAME: 'i dont think this matters'
...
TOPIC NAME: 'just gave it a Random Name, should this refer to sth?'
Source Resource:'My Storage Account'
ENDPOINT:'i got the URL from the Overview page of my logic app (Workflow URL
)'
URL looks like this:
https://LOGICAPPNAME.azurewebsites.net:443/api/APPNAME/triggers/manual/invoke?api-version=2022-05-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=RjVKZbs-0CV559hZYlFfhM0k22W39lS5
when i copy and paste this to my browser i can trigger my Logic App. i think that act as a GET and i'm not sure if it sends it as POST or etc. it would make any difference.
and i got this error.
Deployment has failed with the following error: {"code":"Url validation","message":"Webhook validation handshake failed for https://LOGICAPPNAME.azurewebsites.net/api/APPNAME/triggers/manual/invoke. Http POST request retuned 2XX response with response body . When a validation request is accepted without validation code in the response body, Http GET is expected on the validation url included in the validation event(within 10 minutes). For troublehooting, visit https://aka.ms/esvalidation. Activity id:ID, timestamp: DATE TIME"}
If there's still confusion on how i'm doing this, i'm trying to follow THIS EXAMPLE. How can i fix this Error?
After reproducing from my end, I could able to achieve this following the link you have provided using the below details for creation of my logic app.
The reason you are receiving that error is that you need to use Logic App HTTP Trigger Request URL as Web Hook's endpoint and not the Logicapp's URL.
NOTE: You don't really have to call the Trigger again, whenever you make any changes to your storage account the logic apps gets triggered.
RESULTS:
When Blob is Created
When a Blob is Deleted
REFERENCES: "When blob is added or modified" trigger will not be fired on subfolder" answered by SamaraSoucy-MSFT - Microsoft Q&A

Not getting response to DocuSign webhook listener url

For getting envelop status, I followed these steps
docusign developer account, under connect, I created a connect with webhook url.
In code , I have given eventNotification with webhook listener url with https:// address of my application.
I am getting response in connect logs. But I am not getting any response in my application webhook listner .why?
I have used Laravel code, with route
Route::post('webhook', [TestController::class, 'webhook']);
But I am not getting any response in function?why?
Ensure that your server (the "listener") has an https URL that is visible (callable) from the public internet. Best way to confirm this: implement a GET function at a URL such as https://your-server.com/hello. It should reply with "hello" when called. Then try entering that URL on your mobile phone.
Look at DocuSign's Connect error log to see what it says.
To assure yourself that DocuSign is sending notification messages, first use https://webhook.site to get a test webhook listener URL, and configure DocuSign to use it.
If you feel that the messages are being sent to your server but are not being received by your software, check your web server's logs. For example, if you're including documents in your notifications, the notifications will be very large and may exceed your web server's default configuration limits.
One issue which I have found, the response which is sent from Webhook to our own custom API, which will receive request from webhook does not match
For e.g.argument webhook sends json payload , so make sure you have same object which is supported by your api from docusign connect
// this is C# code
public async Task Post([FromBody] JObject envelopeData)
To test locally, you can use ngrock, which will create local server but you will be able to debug
You can try something as below. The same worked for me.
if (!Request.Body.CanSeek) { Request.EnableBuffering(); }
Request.Body.Position = 0;
var reader = new StreamReader(Request.Body, Encoding.UTF8);
var body = await reader.ReadToEndAsync().ConfigureAwait(false);

How to pass Body Parameters(format) when calling a POST request with Content-Type as form-data in Azure Data Factory

I am trying to call API endpoint as a POST and Content-Type as from-data using azure data factory web activity. Tried different way of passing Body parameters but it failed.
Here is the Postman Request.
Here is the Azure Data Factory Web Activity configurations.(use the body as a json and tried different combinations but all didn't work)
And above is the error message.
Any help would be highly appreciated.
Since your request is seen successfully executing from postman, try copying the entire body from that and use in web activity.
The format for passing body for a POST request from a web activity is shown here.
Also make sure you have entered valid “url–Target endpoint and path”. This is usually seen as Activity requires Public end point but you may have used Private vnet where this is not allowed. Web Activity is supported for invoking URLs that are hosted in a private virtual network as well by leveraging self-hosted integration runtime. The integration runtime should have a line of sight to the URL endpoint.
Note: The activity will timeout at 1 minute with an error if it does not receive a response from the endpoint.
Further going through some similar scenarios it is learnt that;
Mostly the header is passed as string in WebActivity whereas Postman
it is integer/long
In case your API tries redirecting, it seems that the web activity
in Azure Data Factory does not currently support following
redirects, meanwhile Postman and other tools and libraries usually
follow redirects by default or include a option for handling them.
Checkout the supported authentication types in the web activity. If you are trying to authorize your from, try set the following.
URL: https://login.microsoftonline.com/<<tenantid>>/oauth2/token
Headers: Content-Type - "application/x-www-form-urlencoded"
Body: grant_type=client_credentials&client_id=<<clientid>>f&client_secret=<<secret>>&resource=https%3A%2F%2Fmicrosoft.onmicrosoft.com%2F<<resourceId>>
Error code: 2108:
Message: Error calling the endpoint '%url;'. Response status code: '%code;'
Cause: The request failed due to an underlying issue such as network connectivity, a DNS failure, a server certificate validation, or a timeout.
Workaround: Make the API call using Powershell, and call that Powershell script from within Data Factory.

Getting 401/404 errors with Microsoft Azure Cognitive Services API

I followed the directions from https://learn.microsoft.com/en-us/rest/api/computervision/3.1/describeimage/describeimage but each time I fill in my endpoint, as https://[resource_name].cognitiveservices.azure.com or https://southcentralus.api.cognitive.microsot.com, I get a 404 or 401 error, respectively. I've checked to make sure the image url I specify works and loads fine withOUT a 404. Can anyone help?
You can use both hosts below to send request:
https://<your service name>.cognitiveservices.azure.com
https://<your service loaction>.api.cognitive.microsoft.com
You can find all of then on Azure Portal=>Cognitive services=>your service =>Keys and Endpoint:
You should involve key as request header:Ocp-Apim-Subscription-Key to avoid 401 error just as below:
Let me know if you have any more questions.

https:/3dspace/F5Health.html log in Azure application insights

I have created one Node.Js application and I am using Azure application insights in it. Code is very simple. I have started app insights on top of app.js
const appInsights = require('applicationinsights');
appInsights.setup('instrument-key-here');
appInsights.defaultClient.commonProperties = {
'appName': 'Name-Of-MS'
};
appInsights.start();
import express from 'express';
I am able to see telemetry data in azure but the problem I deploy the application on the dev server (Linux)...run my application through PM2.. then I am seeing a huge volume of failed request in the portal as well.. approx 100k, 404 requests are being logged and these are not proper HTTP calls. When I detail in the portal all I see is the request URL https:/3dspace/F5Health.html .. that's it.
Below are details, I am seeing in the portal
Event time 1/24/2021, 4:48:53 PM (Local time)
Request name GET /3dspace/F5Health.html
Response code 404
Successful request false
Response time 1 ms
Request URL https:/3dspace/F5Health.html
Request Id 3e5b5c01556b9
Performance <250ms
Telemetry type request
Operation name GET /3dspace/F5Health.html
Operation Id 984d066c7222428c896260ea2e5
Parent Id 984d066c7222428c8962a0ea2e5
Application version 0.0.1
Device type PC
Operating system Linux 3.10.0-1160.6.1.el7.x86_64
Client IP address 0.0.0.0
Cloud role name Web
Cloud role instance servername.com
SDK version node:1.8.9
Sample rate 1
I am sure from where this request is being logged but it is creating a huge volume of 404 requests with the same param.
Anyone faced a similar issue. How Can I find out from where this request is being logged?

Resources