Home > Software design >  How Can I call Azure function in my web application not hosted on Azure
How Can I call Azure function in my web application not hosted on Azure

Time:08-11

I am trying to learn Azure functions

and i have added a HTTPTrigger function and publish on Azure

Now what if i don't have any web application on azure to test , and I want to test it my already web application on IIS hosted some where else

Can i call Azure function in my web application not hosted on Azure

how can i call it

Tried to search but all information are with azure web application but nothing is related to how can i test it with any .net web application , not sure what am i missing :(

is this even possible ?

CodePudding user response:

If the function is public, you can call it any REST Client like HttpClient in C#. Sample:

var client = new HttpClient();
await client.GetAsync("http://<yourapp>.azurewebsites.net/api/<funcname>?code=<functionkey>");

Be aware that you have to think about authentication

CodePudding user response:

I am not sure if I understand your question completely.

You have an Azure Function deployed and running on Azure, right?

You want to call this Function from a Web Application running on an IIS on-prem, right?

Azure Functions should be callable using any Rest based client.

You may want to investigate the networking tab that there are no restrictions and on your onprem firewal ensure you can reach {functionname}.azurewebsites.net:443

  • Related