title: Cyclic connection failure between Azure functions and MongoDB
body: <p>I deployed a function in Azure that is triggered by a timer, every 5 minutes it executes a GET request to an API and stores the results into MongoDB hosted in a server.</p>
  
  <p>Running the function in my localhost accessing the same MongoDB server works fine, but running the function on Azure I get a exception precisely every 10 minutes (or 2 function executions) as we can see bellow:</p>
  
  <p><a href="https://i.stack.imgur.com/spw8T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/spw8T.png" alt="enter image description here"></a></p>
  
  <p>The exception throw is the following:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I have tried changing the MongoDB client configuration, but didn't work. Any ideias why this happens on Azure and not on the localhost emulator? And more importantly, is there any fix or work around?</p>
  
  <p>Thank you!</p>