title: Azure web app can't access azure DB
body: <p>I have an Azure trial account with an sql database and an asp.net 5 web app. The db server firewall has a rule for my local computer IP, and also the checkbox "Allow access to Azure service" on. I can connect from my local Sql Server Manager to the azure database without incident.</p>
  
  <p>The web app has this connection string set up in its 'Application Settings/Connection strings' section. I'have checked the wep app IS using this connection string:</p>
  
  <blockquote>
    <p>"Server=tcp:[MyServerName].database.windows.net,1433;Database=[MyDbName];User ID=[MyUserName]@[MyServerName];Password=[MyPassword];Encrypt=True;TrustServerCertificate=False;Connection
    Timeout=30;"</p>
  </blockquote>
  
  <p>This same connection string is used in a desktop client and works fine.
  However, the web app is unable to connect to the server, and throws this exception, which is pretty clear, but I don't know how to solve.</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: Named
    Pipes Provider, error: 40 - Could not open a connection to SQL Server)</p>
  </blockquote>
  
  <p>I know very similar questions have been asked and answered here, but none of them are the exact same problem I'm facing, neither have been a solution for me.</p>
  
  <p>Thanks everyone for your time.</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>As a test, I've configured the website to run on my local IIS, against the azure DB, and it works also. So, desktop applications, sql server manager and IIS can access this database from my local computer. Of course my IP is whitelisted in the server firewall, but azure app services are whitelisted also and don't have access.</p>
  
  <p><a href="https://i.stack.imgur.com/8kJop.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/8kJop.jpg" alt="enter image description here"></a></p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Joe Raio's comment made me double check the region configuration, and here's an screenshot of the current settings. I believe everything is correct.</p>
  
  <p><a href="https://i.stack.imgur.com/1bZMm.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/1bZMm.jpg" alt="enter image description here"></a></p>