title: Sql Azure database connection from DNN site
body: <p>I have a dnn website that I'm testing a move to Azure Websites.  What I wanted to do was first recreate the database on Azure and then just change the connection string to point to the azure sql database.  I migrated the database just fine.  It exists in my azure portal and as far as I can tell the data is accurate.</p>
  
  <p>My previous connection string was:</p>
  
  <pre><code>&lt;add name="SiteSqlServer" connectionString="Data Source={SERVERNAME};Initial Catalog={DBNAME};User ID={USERNAME};Password={PASSWORD}" providerName="System.Data.SqlClient" /&gt;
  </code></pre>
  
  <p>Which I changed to the azure connection as follows:</p>
  
  <pre><code>&lt;add name="SiteSqlServer" connectionString="Data Source=tcp:{SERVERNAME}.database.windows.net,1433;Database={DBNAME};User ID={USERNAME};Password={PASSWORD};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient" /&gt;
  </code></pre>
  
  <p>But I get The following error when I try to load the site:
  <img src="https://i.stack.imgur.com/QH2qm.jpg" alt="enter image description here"></p>
  
  <p>and the url that is hsown in the browser is:
  <strong>mysite.com/Install/UnderConstruction.htm</strong></p>
  
  <p>I am not sure how to trouble shoot this.  Is the database not connecting or is the connection good and another problem is happening.  I have not changed any files in the root of my stie.  I just changed the connection string to point to the new azure database.</p>
  
  <p>I can connect to this database successfully from Sql Management Studio using the connection credentials fro the connection string.  </p>
  
  <h2>QUESTION:</h2>
  
  <p>How can I tell if this is a database connection issue or trouble shoot why this error appears.</p>
  
  <p>Alternatively,  do I need to enable a firewall access for the external IIS server IP that the site's files are hosted on?</p>
  
  <h2>BEGIN EDIT 1:</h2>
  
  <p>So I logged into my sql azure database in question and included more metrics in the monitoring page.  I could see that there were connections that failed due to being blocked by the firewall, as shown below.
  <img src="https://i.stack.imgur.com/sLzoz.jpg" alt="enter image description here"></p>
  
  <p>SO I got he IP address of the shared IIS server where my website files reside and added a firewall rule to allow that IP address.  THis did not solve the problem.</p>
  
  <p><strong>Follow up Question:</strong> is there a way to tell what the ip address is of the failed connection that was blocked by the firewall?</p>
  
  <h2>END EDIT 1:</h2>
  
  <p>Thanks in advance</p>