2

Azure function (Timer trigger) uses Restsharp to make a REST call to an external API, which is failing with error

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. A connection attempt failed because the connected party did not properly respond after a period of time

The external API provider has added to the allow list all Azure function app Outbound IP's and local system IP. My code works locally well, but after publishing on Azure the Azure function throws this error.

We wrote code to get IP inside Azure function, and when azure function run on azure it gave one from outbound IP address and which is whitelisted.

Is there anything else that could block by firewall? What actually does the Azure Function do when it makes an outside call. Any reference please?

d219
  • 2,707
  • 5
  • 31
  • 36
Darshana
  • 601
  • 2
  • 9
  • 20
  • Out of interest did your code actually get the IP from within the function app or did it return the IP of the calling system? I've only been able to do that later. Also what plan was the function app running on? I had a similar issue (see following) which doesn't appear to have been down to the wrong IP going in the allow list but simply that the IP's given are unreliable/useless on the consumption plan https://stackoverflow.com/questions/72062638/sqlexception-server-not-found-error-when-connecting-to-an-sql-db-from-an-azure-f/72064236?noredirect=1#comment127338726_72064236 – d219 Apr 30 '22 at 11:10

1 Answers1

-1

Thank you ZainD365 Posting your suggestion as an answer to help other community members.

A connection attempt failed because the connected party did not properly respond after a period of time,,,

"This error can be resolved by creating a Azure Virtual Network NAT gateway. Then whitelisiting the static ip addresses on the webservice firewall."

For more information about the similar issue please refer the below links:

GitHub issue: Troubleshooting HttpRequestException "A connection attempt failed because the connected party did not properly respond..."

SO THREAD : How to call an API using time trigger Azure function

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15
  • Thank you, I will check it and will update here. – Darshana Nov 03 '21 at 12:54
  • 1
    Our client has whitelisted IP which we given to them and they did mistake there, so once IP properly whitelisted it works with no issue. Anyways someone else mark it un useful answer. – Darshana Nov 08 '21 at 05:17