0

I have written a HTTP trigger azure function that executes a series of operations (like add files to blob storage, list them, delete them or do some more time requiring tasks through orchestrator), according to Azure Durable Function.

I want to retrieve the status of such time requiring tasks through an additional azure function that, based on the job id of the orchestrator, returns "Pending", "Completed" or "Failed". In order to do that, I need to make a request inside the main HTTP trigger function to ask for such status.

I've tried:

Neither of them apparently works locally, since Visual Studio Code in debug mode completely freezes. Can it be due to authorization issues or is it not possible to trigger another azure function locally? Will it work once I deploy the code?

I've read the suggested articles in stackoverflow and the relative azure functions documentation, but none of them is providing a complete answer.

1 Answer 1

2

How to trigger a http azure function from another azure function

In C# you can call using httpClient as below:

var r = await httpClient.GetAsync("http://localhost:7114/api/Function1");
var c = await r.Content.ReadAsStringAsync();
var response = req.CreateResponse(HttpStatusCode.OK);

enter image description here

Output of both functions:

Function which is called from Another function(Function 1 should start executing like below: enter image description here

Then when I run function 2 and this is function1 logs:

enter image description here

For further you can refer this.

For python in VS CODE:

In Visual Studio defaultly, different Projects run on different ports where as In VS code same port is used and you will get this error:

enter image description here

Deploy to Portal: enter image description here

Then get the URL like below:

enter image description here

For that you need to deploy your function first to azure and then get the URL and make it working like below:

u='https://rith34.azurewebsites.net/api/HttpTrigger1?code=jd5WmzFuRxdyTg=='

requests.post(u)

enter image description here

requirements.txt:

enter image description here

Output in Portal:

Check the deployed function monitor section:

enter image description here

For further refer similar example.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.