Wednesday, May 01, 2013

Windows Azure - SQL Server Environment - Connection String

I've been going through the Hands on Labs for Windows Azure.  I made it to the Windows Azure Web Sites and Virtual Machines using ASP.NET and SQL Server - for Visual Studio 2012 lab before I encountered an issue. 

The issue was around the SQL Server connection string that is changed in the web.config of the Visual Studio code.  Here is what the lab shows:

<add name="ContactManagerDb" connectionString="Data Source={yourServerAdress},{yourPort};Initial Catalog=ContactManagerDb;User Id={username};Password={password};" providerName="System.Data.SqlClient" />  

My confusion came from the fact that during the lab we worked with 2 ports and 2 usernames.  At first I could not get any combination to work.  I finally figured it out and need to write it down, as I will forget this tomorrow :). 

The server address is the DNS name that can be found on the dashboard of the virtual machine.  The port is the Public Port of the TCP endpoint.  The User Id and Password are the SQL username and password, not the virtual machine username and password.  In this lab that would be "TestUser".

I also opened both the 1433 port and the 57501 Port in the Windows Firewall Rule.  This does not seem to be the issue, as it appears just 1433 works.

No comments: