Windows Azure Platform Training Kit – October Update is Live

Aligned with the SQL Azure October CTP release today we have published an updated version of the Windows Azure Platform Training Kit here
http://www.microsoft.com/downloads/details.aspx?FamilyID=413E88F8-5966-4A83-B309-53B7B77EDF78 

While the Download Center servers are being replicated you will want to make sure the title of the page contains “October Update” and the File Name is “WindowsAzurePlatformKitOctober2009.exe”.

This update contains a few new sections with the Hands On Lab for dealing with the firewall and how to use BCP to move data into SQL Azure.  The training kit contains the following SQL Azure related content.

Presentations

  • Introduction to SQL Azure
  • Building Applications using SQL Azure
  • Scaling Out with SQL Azure

Demos

  • Preparing your SQL Azure Account
  • Connecting to SQL Azure
  • Managing Logins and Security in SQL Azure
  • Creating Objects in SQL Azure
  • Migrating a Database Schema to SQL Azure
  • Moving Data Into and Out Of SQL Azure using SSIS
  • Building a Simple SQL Azure App
  • Scaling Out SQL Azure with Database Sharding

Hands On Labs

  • Introduction to SQL Azure
  • Migrating Databases to SQL Azure
  • Building Your First SQL Azure App

Feature complete SQL Azure October CTP available today

With PDC around the corner the SQL Azure team has delivered an updated CTP that’s feature complete, running on production clusters and containing cool new features like firewall, table value parameters, support for BULK INSERT and new data types.  Checkout the product team blog for details.

So, what does this new release mean to developers?

Move Forward with Confidence

Now that you can get your hands on a feature complete version of SQL Azure you can have confidence that when SQL Azure Database becomes generally available, all your databases and data will be automatically converted into an active subscription to the service based on the subscription offer you choose at go-live.

imageNew Portal

The October CTP is running in a new, production-ready cluster.  You can access the new developer portal for the October CTP via the same URL as before https://sql.azure.com/ which you will notice has an updated skin and a few new features.

Another thing you may notice is that your existing projects are no longer showing up!  You can access your August CTP project through the developer portal available at this URL https://ctpportal.database.windows.net.

New Server URI

With the release of the October CTP you will also need to create a new server for your account.  This is the same process for creating a server as you may have followed for the August CTP.  Guidance on this is available in the Introduction to SQL Azure hands on lab in the Window Azure Platform Training Kit.

One interesting thing to note is that the Server Location is South Central US which is right alongside Windows Azure so you should see even less latency between the services.

The other big thing to know is that there is a different URI for the Server Name.  Before the syntax was

<MY_SERVER_NAME>.ctp.database.windows.net

To access servers created in the production cluster you remove the “ctp.” portion of the Server Name.  A connection to the new server will be

<MY_SERVER_NAME>.database.windows.net

I have a feeling that this is going to trip up a bunch of developers so hopefully this helps.  Another area I believe will catch a number of people off guard is the firewall feature.

New Firewall Feature

For years we’ve been telling people to lock down access to their databases machines.  With the August CTP of SQL Azure there was no way to limit access to what machines had access to your server.  With the October CTP you can now specify which IP addresses have access to your server which is awesome! 

By default no IP’s are allowed to access your server.  If you try to connect you will get the following error.

TITLE: Connect to Server
——————————

Cannot connect to m9vhbwlttp.database.windows.net.

——————————
ADDITIONAL INFORMATION:

Cannot open server ‘<MY_SERVER_NAME>’ requested by the login. Client with IP address ‘<MY_IP_ADDRESS>’ is not allowed to access the server.
Login failed for user ‘<MY_USERNAME>’. (Microsoft SQL Server, Error: 40615)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=40615&LinkId=20476

 

imageYou can modify the firewall rules via the portal, T-SQL stored procs or web service API’s which you can view MSDN docs for details on.  Using the portal just click on the Firewall Settings tab.  From there you can either check the box to Allow Microsoft Services access to this server which will enable all Windows Azure Web and Worker Roles to access your server.   

imageAdditionally, you can click the Add Record button and add your current IP address which is shown in the dialog box.

These updated rules may take up to 5 minutes for the change to take affect so please be patient.

Moving Your Data and Databases

First, you will need to move databases from the current CTP cluster over to the new cluster.  As mentioned above, these are separate, distinct machine clusters and actually reside in different data centers. More importantly, the data and databases you create in the October CTP will automatically roll over into the production service at go-live – at which point we will start to charge for those databases based on the service offering you’ve sign up for. Rather than risk inadvertently charging people for a bunch of test databases, the team got feedback that it was best to allow people to ‘opt-in’ to the new cluster. That way, people will only get charged for what they need and use.

Creating databases in the October CTP will be even easier and faster than on the August CTP. I’d recommend checking out the Migrating Databases to SQL Azure lab in the Windows Azure Platform Training Kit for guidance on moving data with BCP and SSIS.  With the BULK INSERT support in the October CTP developers can deploy BCP.EXE into a Windows Azure Worker Role eliminating the need to copy the data down locally. 

As I mentioned, SSIS is also an option, although we know that customers have experienced performance issues with the SQL Server 2008 Integration Services and SQL Azure.  The next CTP of SQL Server 2008 R2 will have an update to SSIS which dramatically increases performance when loading data in SQL Azure.

Specify Database Edition

With this CTP you can also use a MAXSIZE clause when executing CREATE TABLE to select Web or Business Edition.

CREATE DATABASE foo (MAXSIZE = 1GB)

Or

CREATE DATABASE foo (MAXSIZE = 10GB)

What’s Next?

Everyone is driving hard towards PDC and we are all very excited for Commercial Availability.  Keep your eyes pealed for updates to SQL Server Management Studio and SQL Server Integration Services as part of the SQL Server 2008 R2 wave.  With the updates to SSMS you will be able to use the Object Browser and have an option for exporting SQL Azure compatible scripts.  With the updates to SSIS you will see dramatic performance improvements when loading data in a SQL Azure database.

USE statement is NOT supported in SQL Azure CTP1

So, now that you’ve got a token and can connect to SQL Azure, you probably want to create a database and start using it.  There’s one thing that can cause a ton of heart ache…  USE <database> is not supported!

The reason USE <database> isn’t support is because when you connect to one database you are essentially being tied to a particular server cluster via the SQL Azure TDS Gateway.  Your database aren’t all on the same physical machine, therefore you must specify the database when you connect.  Does that make sense?

For example, let’s say you are using SQLCMD or SSMS to work with SQL Azure…  Let’s look at a common use case.

First, I’ll connect to SQL Azure with my Administrative User that I created when I redeemed my token.  In this case that username is admin.  This user can be thought of like sa in on-premise SQL Server.  I’ll connect to a server named h38ssfjeiwh201 which was automatically assigned to me.  In this case I won’t specify a database name, so it will default to my virtual master database.

NOTE: In these samples I’m showing connecting via SQLCMD but you won’t get all of the same messages on success, although the errors will be the same.

sqlcmd -S h38ssfjeiwh201.ctp.database.windows.net -U admin@h38ssfjeiwh201

Now, I’ll go ahead and create a new database named sample_db with TSQL.

CREATE DATABASE sample_db;
GO

NOTE: Future versions of SQL Azure will support a MAXSIZE clause to the CREATE DATABASE statement for create 1GB or 10GB databases.

I’ll get a message saying things are looking good.

Command(s) completed successfully.

Great!  Now, I want to start using that database…  So like any novice SQL Server developer I try to use it.

USE sample_db;
GO

The problem is I get the following error…

Msg 911, Level 16, State 1, Line 1

Database ‘sample_db’ does not exist. Make sure that the name is entered correctly.

Uh…  Ok.  Let me try again…  I thought I typed it right but maybe I’m missing something.

CREATE DATABASE sample_db;
GO

Now I get the following error…

Msg 1801, Level 16, State 1, Line 1

Database ‘sample_db’ already exists. Choose a different database name
.

I know… I know… These error messages need to be improved. The problem is like I mentioned in the title of this post. SQL Azure does not currently support the USE <database> statement.

What I need to do is actually reconnect by specifying the database name as a connection parameter in SQLCMD or by specifying the Connect to database in the Options >> on the connection dialogue in SSMS.

sqlcmd -S h38ssfjeiwh201.ctp.database.windows.net -U admin@h38ssfjeiwh201 -d sample_db

Now I can go about interacting with sample_db just like I would any other SQL Server database (for the most part).

For additional information about this see the Intro to SQL Azure hands on lab and demos in the Windows Azure Platform Training Kit.

SQL Azure Invitation Codes

Updated March 2010: In February of 2010 the Windows Azure Platform reached commercial availability. The benefit of this is the platform is ready for production use. One of the downsides is that you can’t get invitation codes for free. There are some offers available for getting started with Windows Azure, SQL Azure and AppFabric. You can check these out here: http://www.microsoft.com/windowsazure/offers/.

Now that CTP1 is out the door a question that keeps coming up is…  “I registered for a token a couple months ago…  When am I going to get an email with my Invitation Code?”  We are glad that people are as excited about the SQL Azure release as we are so we love this question!

Over the next week or two everyone who has already signed up for a SQL Azure Invitation Code should be receiving an email sent to the address associated with your Live ID containing the token and a link to redeem it.  We understand that everyone would like their tokens yesterday but we need to work through the list and ramp up the service.

Once the list of current requests has been processed, new requested will be fulfilled within a day or two.

We are working on integrating the SQL Azure and Windows Azure provisioning experience.  We realize that it is very inconvenient to have to have to make requests for two different tokens from different places. 

What about customers who already have an account on the previous version of SQL Data Services/SQL Server Data Services which had an ACE model with a REST API?  When will they get tokens?  We will be providing all of those users with a token, but in the meantime I’d recommend that all of those users sign up for the CTP.

If you haven’t already done so, please sign up for the CTP today!
http://go.microsoft.com/fwlink/?LinkID=149681&clcid=0x09

Connecting to SQL Azure

So, now that SQL Azure CTP1 has been released there are a few things that most people will probably run into when trying to connect to SQL Azure with SQL Server Management Studio (SSMS), SQLCMD and OSQL.

SQL Server Management Studio

Update March 2010: With the release of the SQL Server 2008 R2 Tools November CTP working with SQL Azure from SSMS is much better.  Please read my new post if you want to use the updated tools.

One of the best parts about working with SQL Azure is that you can use the tools that you already know and love.  There are some differences though with the System Views, System Stored Procedures, System Tables and SMO that break some of those tools.  The current version of SSMS 2008 is able to connect to SQL Azure but the Object Browser doesn’t work.  There is also a trick to getting connected.

When you fire up SSMS and are presented with connection dialog box, if you enter your credentials you will get the following error.

TITLE: Connect to Server
——————————
Cannot connect to MY_SERVER_NAME.ctp.database.windows.net.
——————————
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
Invalid object name ‘sys.configurations’. (Microsoft SQL Server, Error: 208)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.9006&EvtSrc=MSSQLServer&EvtID=208&LinkId=20476

The key to getting around this is to click on the Cancel button on the initial dialogue box.

image

Then click on the New Query button.

image

You will be presented with a new connection dialogue that looks the same as the initial one.

image

Enter your credentials, if you are trying to connect to a specific database click on the Options and enter a database name because USE <database> is not supported.

Once you connect you will get a error

TITLE: Microsoft SQL Server Management Studio
——————————
Unable to apply connection settings. The detailed error message is: ‘ANSI_NULLS’ is not a recognized SET option.

You can just click OK.

Now you are good to go!  You can issue queries, visualize explain plans, etc.

 

SQLCMD and OSQL

For those of us who like to use command line tools, SQLCMD and OSQL are also supported.  The key when connecting with these tools is that you must use the <username>@<servername> in the connection string.

sqlcmd -S MY_SERVER_NAME.ctp.database.windows.net -U MY_USERNAME@MY_SERVER_NAME -d DATABASE_NAME

The key here is that you must use MY_USERNAME@MY_SERVER_NAME…  For example, if your server name is h38ssfjeiwh201, your username is admin and connecting to sample_db your connection would be.

sqlcmd -S h38ssfjeiwh201.ctp.database.windows.net -U admin@h38ssfjeiwh201 -d sample_db

Since SQL Azure doesn’t currently support the USE <database> you need to specify a database name.

 

More Information