I must have missed it in the release notes but when you have access to the AppFabric Apps CTP, you are only allowed on SQL Azure instance within this Labs environment. When you first log into the Portal you will see a SQL Azure DB that has a name of LabsSqlDatabase. The problem is that you can’t actually create another one here and if you do try to access this database you will not be able to connect to it using the Database Name LabsSqlDatabase.
What is a little confusing is when you are working within your Local Dev Fabric that you can specify any name you want in your SQL Azure cofig for your DatabaseName. The problem is this name will not exist in the cloud if you want to access it after you have published your AppFabric Application.
The error message that you will receive will resemble the following:
So due to this current limitation (it is CTP – I am ok with it), you need to use the database that was provisioned for you when you were granted access to the CTP Labs enviornment. To do this you will need to get your connection string from the Labs Portal by clicking on LabsSqlDatabase then click on the View button below the Connection String label. A dialog box will appear and you can copy your connection string by clicking the Copy to Clipboard button.
If we paste this value in notepad we will discover the following connection string. The Data Source represents the name of the server (s) that our database will be running on. Next we have an Initial Catalog value which is the actual name of our database that has been provisioned for us….not LabsSqlDatabase. In my case, and I would imagine others, my Initial Catalog value is the same as my user id. If have blacked out portions of these values for privacy reasons.
If I now try to connect to this database either through SQL Management Studio or Database Manager Portal, using this initial catalog value for my Database Name, I will have success.
At this point we are free to run any of our SQL scripts to generate tables, stored procedures or load data.
I hope this post will save some others some time as it did create some confusion for me. Admittedly I sometimes dive right into things instead of thoroughly reviewing the documentation (what fun is that). From what I gather, it is possible to hook up an AppFabric Application to an existing SQL Azure database that exists in the NON-LABS environment. So if you really need to create multiple SQL Azure databases that is also an option. Since I am just playing around with this stuff having a single SQL Azure instance works for me now that I understand the limitations of the Labs environment.