title: Ping server from Azure Function
body: <p>I have the following Azure Function that fails with <em>Access is Denied</em>
  (ignore the fact that the logic is all weird, I'm just doing a first test) </p>
  
  <pre><code>public static void Run(TimerInfo myTimer, ILogger log)
  {
      List&lt;string&gt; servers = new List&lt;string&gt;()
      {
          "server1"
      };
  
      foreach(string server in servers)
      {
          if (!Ping(server))
          {
              SendEmail($"Server {server} seems down.", log);
          }
      }
  }
  
  static bool Ping(string hostName)
  {
      Ping pingSender = new Ping();
      int timeout = 120;
      PingReply reply = pingSender.Send(hostName, timeout);
      return reply.Status == IPStatus.Success;
  }
  
  static void SendEmail(string message, ILogger log)
  {
      log.LogInformation(message);
  }
  </code></pre>
  
  <p>If I change the lines </p>
  
  <pre><code>PingReply reply = pingSender.Send(hostName, timeout);
  return reply.Status == IPStatus.Success;
  </code></pre>
  
  <p>to <code>return true;</code> for the sake of testing, the function runs well.</p>
  
  <p>What do I need to configure so the function can do the ping?</p>