title: The wait operation timed out establishing a connection to SQL Server FROM Azure Function App
body: <p>I am building a Function App in Azure and I'm trying to connect to a third party SQL Server. I added in the Application Settings of the function the connection string like this:</p>
  
  <pre><code>Server=[servername],1433;Initial Catalog=[dbname];Persist Security Info=False;
  User ID=[myuser];Password=[mypassword];MultipleActiveResultSets=False;
  Encrypt=False;TrustServerCertificate=True;Connection Timeout=30;
  </code></pre>
  
  <p>Of course I replaced the strings on [] with the real values, but every time I try to connect to the server I get this error:</p>
  
  <blockquote>
    <p>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.)  </p>
    
    <p>System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out</p>
  </blockquote>
  
  <p>When I try to connect to the same server, with the same credentials from my local Management Studio it connects correctly, so what am I doing wrong in the connection from Azure?</p>
  
  <p>Thanks for the inputs!</p>