Archive for the ‘SQL Azure’ Category.

Windows Azure Platform Training Kit, December 2010 Update

I am happy to announce that we have released the December 2010 update to the Windows Azure Platform Training Kit.

The Windows Azure Platform Training Kit includes a comprehensive set of technical content including hands-on labs, presentations, and demos that are designed to help you learn how to use the Windows Azure platform including: Windows Azure, SQL Azure and the Windows Azure AppFabric.

The December update provides new and updated hands-on labs, demo scripts, and presentations for the Windows Azure November 2010 enhancements and the Windows Azure Tools for Microsoft Visual Studio 1.3. These new hands-on labs demonstrate how to use new Windows Azure features such as Virtual Machine Role, Elevated Privileges, Full IIS, and more. This release also includes hands-on labs that were updated in late October and November 2010 to demonstrate some of the new Windows Azure AppFabric services that were announced at the Professional Developers Conference (http://microsoftpdc.com) including the Windows Azure AppFabric Access Control Service, Caching Service, and the Service Bus.

image

Some of the specific changes with the December update of the training kit include:

  • [Updated] All demos were updated to the Azure SDK 1.3
  • [New demo script] Deploying and Managing SQL Azure Databases with Visual Studio 2010 Data-tier Applications
  • [New presentation] Identity and Access Control in the Cloud
  • [New presentation] Introduction to SQL Azure Reporting
  • [New presentation] Advanced SQL Azure
  • [New presentation] Windows Azure Marketplace DataMarket
  • [New presentation] Managing, Debugging, and Monitoring Windows Azure
  • [New presentation] Building Low Latency Web Applications
  • [New presentation] Windows Azure AppFabric Service Bus
  • [New presentation] Windows Azure Connect
  • [New presentation] Moving Applications to the Cloud with VM Role

Give it a try today!

In addition to the training kit, we have updated the Windows Azure Platform Training Courses on MSDN.

The Windows Azure Platform Training Course includes a comprehensive set of hands-on labs and videos that are designed to help you quickly learn how to use Windows Azure, SQL Azure, and the Windows Azure AppFabric. This release provides new and updated hands-on labs for the Windows Azure November 2010 release and the Windows Azure Tools for Microsoft Visual Studio 1.3. Some of these new hands-on labs demonstrate how to use new Windows Azure features such as Virtual Machine Role, Elevated Privileges, Full IIS, and more. This release also includes hands-on labs that were updated in late October 2010 to demonstrate some of the new Windows Azure AppFabric services that were announced at the Professional Developers Conference (http://microsoftpdc.com) including the Windows Azure AppFabric Access Control Service, Caching Service, and the Service Bus.

image

Using the ‘TrustServerCertificate’ Property with SQL Azure and Entity Framework

I’ve spent the last few days refactoring a web application to leverage SQL Server via Entity Framework 4.0 (EF4) in preparation for migrating it to SQL Azure.  It’s a neat application, and a great example of how to fully encapsulate your data tier (the previous version had issues due to tight coupling between the data and web tier).  More on this soon.

So, when I deployed my database to SQL Azure (using the SQL Azure Migration Wizard) I was confounded by the following error:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 – The certificate’s CN name does not match the passed value.)

I was caught off guard by this error, as I was pretty sure my connection string was valid – after all, I had copied it directly from the SQL Azure portal.  Then I realized that this was the first time I had attempted to use EF4 along with SQL Azure; my first thought was, “oh crap!”

After a little bit of frantic research I found the following question on the SQL Azure forums.  Raymond Li of Microsoft made the suggestion to set the ‘TrustServerCertificate’ property to True.  So, I updated my connection string from …

<add name="BidNowDataContext"
	connectionString="metadata=
		res://*/BidNowDataContext.csdl|res://*/BidNowDataContext.ssdl|
		res://*/BidNowDataContext.msl;
	provider=System.Data.SqlClient;
	provider connection string=&quot;
		Server=tcp:SERVERNAME.database.windows.net;Database=BidNow;
		User ID=USERNAME@SERVERNAME;Password=PASSWORD;
		Trusted_Connection=False;Encrypt=True;&quot;"
	providerName="System.Data.EntityClient" />


… to …

<add name="BidNowDataContext"
	connectionString="metadata=
		res://*/BidNowDataContext.csdl|res://*/BidNowDataContext.ssdl|
		res://*/BidNowDataContext.msl;
	provider=System.Data.SqlClient;
	provider connection string=&quot;
		Server=tcp:SERVERNAME.database.windows.net;Database=BidNow;
		User ID=USERNAME@SERVERNAME;Password=PASSWORD;
		Trusted_Connection=False;Encrypt=True;trustServerCertificate=true;
		&quot;"
	providerName="System.Data.EntityClient" />


… and voilà!  It worked!

Turns out that when Encryt=True and TrustServerCertificate=False, the driver will attempt to validate the SQL Server SSL certificate.  By setting the property TrustServerCertificate=True the driver will not validate the SQL Server SSL certificate.

Of course, once I learned tried this I came across an article on MSDN called How to: Connect to SQL Azure Using ADO.NET to says to set the TrustServerCertificate property to False and the Encrypt property to True to prevent any man-in-the-middle attacks, so I guess I should include the following disclaimer: Use at your own risk!

SQL Azure Adds Support for Database Copy

The SQL Azure team has announced SQL Azure Service Update 4, which includes database copy, an improved help system, and deployment of Microsoft Project Code-Named “Houston” to multiple data centers.  See the SQL Azure Team Blog for the formal announcement.

Customers have been asking for a way to backup databases with SQL Azure for a long time, and the new database copy capabilities will provide a lot of support.  From the SQL Azure Team Blog:

Support for database copy: Database copy allows you to make a real-time complete snapshot of your database into a different server in the data center. This new copy feature is the first step in backup support for SQL Azure, allowing you to get a complete backup of any SQL Azure database before making schema or database changes to the source database. The ability to snapshot a database easily is our top requested feature for SQL Azure, and goes above and beyond our database center replication to keep your data always available. The MSDN Documentation with more information is entitled: Copying Databases in SQL Azure.

Good stuff.  So, if you want to rename a database, you can do this …

// Rename a database
ALTER DATABASE database1 modify name=database2


… if you want to make a copy of a database, you can do this …

// Create a consistent copy of a database
CREATE DATABASE database2 AS COPY OF database1


… and finally, if you want to track the copy progress of a database, you can do this …

// Keep track of the copy progress
SELECT * FROM sys.dm_database_copies


There is also some great “How-To” documentation that’s been published to MSDN that you should take a look at:

And don’t forget about “Houston”.  Microsoft project Microsoft Project Code-Named “Houston” (Houston) is a light weight web-based database management tool for SQL Azure. Houston, which runs on top of Windows Azure is now available in multiple datacenters reducing the latency between the application and your SQL Azure database.

Enjoy!