<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">In The Cloud</title><subtitle type="html">Thoughts and development techniques for managing your data in the cloud</subtitle><id>http://blogs.msdn.com/b/wayneb/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/wayneb/" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/b/wayneb/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2012-09-12T11:04:27Z</updated><entry><title>Introducing sys.database_connection_stats for Troubleshooting Windows Azure SQL Database</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/wayneb/archive/2012/11/02/introducing-sys-database-connection-stats-for-troubleshooting-windows-azure-sql-database.aspx" /><id>http://blogs.msdn.com/b/wayneb/archive/2012/11/02/introducing-sys-database-connection-stats-for-troubleshooting-windows-azure-sql-database.aspx</id><published>2012-11-02T18:40:22Z</published><updated>2012-11-02T18:40:22Z</updated><content type="html">&lt;p&gt;Windows Azure SQL Database (formerly Sql Azure) now has a new system view called &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj819228.aspx"&gt;sys.database_connection_stats&lt;/a&gt; to help database Administrators track the status of incoming connections. The &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj819228.aspx"&gt;sys.database_connection_stats&lt;/a&gt; gives insight into how many incoming TDS connections are successful, terminated, throttled, and failed aggregated to a five minute window.&lt;/p&gt;  &lt;p&gt;Before this feature improvement, application developers needed to catch and record connection failures and successes on the client-side, reporting back to their database administrator how well SQL Database was coping with the application’s requests. Now with &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj819228.aspx"&gt;sys.database_connection_stats&lt;/a&gt;, this functionality has been moved to the server, allowing administrators to query SQL Databases for aggregated statistics about their database.&lt;/p&gt;  &lt;h2&gt;Permissions&lt;/h2&gt;  &lt;p&gt;The view is accessed by connecting to the master database and only Administrators with permission to access the &lt;strong&gt;master&lt;/strong&gt; database have read-only access to this view. Because this data is stored in the master database, the room to store this data is not counted as part of the user’s bill.&lt;/p&gt;  &lt;h2&gt;Latency&lt;/h2&gt;  &lt;p&gt;There is some lag from when the connection is made to when an increment for it will show up in the &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj819228.aspx"&gt;sys.database_connection_stats&lt;/a&gt; view. Typically the view will be updated within the hour, however it might take up to 24 hours for the view to update. During that time, the information within a single row may be updated after the row is first written. SQL Database is a multi-tenant system with many nodes that participate in handling the connection, each one of those nodes can add data to the row.&lt;/p&gt;  &lt;h2&gt;Querying For Database Connection Statistics&lt;/h2&gt;  &lt;p&gt;Connect to the master database for your server and execute this query to view the database connection statistics:&lt;/p&gt;  &lt;p&gt;SELECT *&lt;/p&gt;  &lt;p&gt;FROM sys.database_connection_stats&lt;/p&gt;  &lt;p&gt;I am using Sql Server Management Studio 2012 and my results look like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/0882.clip_5F00_image001_5F00_77BA6F39.png"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image001" border="0" alt="clip_image001" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/4682.clip_5F00_image001_5F00_thumb_5F00_2BBEE8C0.png" width="644" height="187" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Notice that the time slices are broken down into 5 minute increments for my database. Also notice that this is a low traffic database so there are some time gaps where there were no connections. If I wanted to graph this data, it would be easiest if the time gaps were filled in with zero counts before graphing. I can do this with T-SQL that looks as follows:&lt;/p&gt;  &lt;p&gt;DECLARE @Start datetime = '2012-10-25 00:00';&lt;/p&gt;  &lt;p&gt;DECLARE @End datetime = '2012-10-26 00:00';&lt;/p&gt;  &lt;p&gt;DECLARE @databaseName nvarchar(100) = 'Kulshan';&lt;/p&gt;  &lt;p&gt;WITH Times (start_time) AS&lt;/p&gt;  &lt;p&gt;( SELECT @Start&lt;/p&gt;  &lt;p&gt;UNION ALL&lt;/p&gt;  &lt;p&gt;SELECT DATEADD(minute,5, start_time)&lt;/p&gt;  &lt;p&gt;FROM Times&lt;/p&gt;  &lt;p&gt;WHERE start_time &amp;lt; @End&lt;/p&gt;  &lt;p&gt;)&lt;/p&gt;  &lt;p&gt;SELECT Times.start_time, ISNULL(DCS.success_count,0) + ISNULL(total_failure_count,0) 'total_connection_count',&lt;/p&gt;  &lt;p&gt;ISNULL(database_name,@databaseName) 'database_name'&lt;/p&gt;  &lt;p&gt;FROM Times&lt;/p&gt;  &lt;p&gt;LEFT OUTER JOIN sys.database_connection_stats AS DCS ON DCS.start_time = Times.start_time&lt;/p&gt;  &lt;p&gt;WHERE ((DCS.start_time &amp;gt;= @Start AND DCS.start_time &amp;lt; @End) OR DCS.start_time IS NULL) AND&lt;/p&gt;  &lt;p&gt;(DCS.database_name = @databaseName OR DCS.database_name IS NULL)&lt;/p&gt;  &lt;p&gt;ORDER BY Times.start_time&lt;/p&gt;  &lt;p&gt;OPTION (MAXRECURSION 0);&lt;/p&gt;  &lt;p&gt;The results look like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/7725.clip_5F00_image002_5F00_2718B839.png"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/6648.clip_5F00_image002_5F00_thumb_5F00_465B5F0C.png" width="404" height="336" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now I can graph it in Excel and we have a graph of connections for the day:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/5661.clip_5F00_image003_5F00_50AC836C.png"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image003" border="0" alt="clip_image003" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/8880.clip_5F00_image003_5F00_thumb_5F00_6B0C7683.png" width="644" height="369" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Conclusion and More Information&lt;/h2&gt;  &lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj819228.aspx"&gt;sys.database_connection_stats&lt;/a&gt; system view is an important new management and troubleshooting feature for Windows Azure SQL Database. Using this new view, administrators can monitor successful connections, terminated connections and throttled connections, and correlate this to specific time windows during the ongoing operation of applications using the database. You can read more about &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj819228.aspx"&gt;sys.database_connection_stats&lt;/a&gt; on its &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj819228.aspx"&gt;MSDN page&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;{6230289B-5BEE-409e-932A-2F01FA407A92}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10365342" width="1" height="1"&gt;</content><author><name>Wayne Walter Berry</name><uri>http://blogs.msdn.com/Wayne-Walter-Berry/ProfileUrlRedirect.ashx</uri></author><category term="Sql Azure" scheme="http://blogs.msdn.com/b/wayneb/archive/tags/Sql+Azure/" /></entry><entry><title>Understanding Windows Azure SQL Database Size</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/wayneb/archive/2012/10/23/understanding-windows-azure-sql-database-size.aspx" /><id>http://blogs.msdn.com/b/wayneb/archive/2012/10/23/understanding-windows-azure-sql-database-size.aspx</id><published>2012-10-23T15:50:00Z</published><updated>2012-10-23T15:50:00Z</updated><content type="html">&lt;p&gt;The database on Windows Azure Sql Database is stored in two parts: Database data and metadata. Database data is the data in the tables and indexes and is stored in page files. Metadata is the stored procedures, functions, cached query plans, etc… that are related to your database. Metadata is stored in the pages of the system tables of the physical server.&lt;/p&gt;  &lt;p&gt;This blog post will discuss how the two types of data that comprise your Windows Azure Sql Database are different and how they are reflected in the bill you are charged monthly for usage.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/5824.image_5F00_2AA5238D.png"&gt;&lt;img style="border: 0px currentcolor; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/6153.image_5F00_thumb_5F00_4FC26DF9.png" width="555" height="382" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Page Data&lt;/h2&gt;  &lt;p&gt;The table and index data are stored in page files on three physical servers. One copy of the data is the primary and the other two copies are the secondary backups. The secondary copies are exact replicas of the primary data, but the physical storage sizes may differ. If the primary fails over or the database needs to be load balanced to another server, Windows Azure Sql Database has the option of promoting one of the secondary copies to a primary. Therefore, switching the primary replica can cause the size of the database to grow or shrink as reported in the bill.&lt;/p&gt;  &lt;p&gt;Even though there are at least three copies of the data, the bill is based on the reserve size of the primary. The following query retrieves pages utilized on the primary replica at the time of execution:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;SELECT SUM(reserved_page_count) 'pages'&lt;/p&gt;    &lt;p&gt;FROM sys.dm_db_partition_stats&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;To calculate the number of bytes that are reserved for a single copy of your database all you need to know is that there are 8192 bytes per page. You can run this query when connected to your Windows Azure Sql Database to determine the number of reserved bytes:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;SELECT SUM(reserved_page_count) * 8192 'bytes'&lt;/p&gt;    &lt;p&gt;FROM sys.dm_db_partition_stats&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Total database size (the reserved size) is larger than the size of the data in the database. It includes overhead storage structures required to use the database as well as potentially free space on each page that is currently unused. For more information, please refer to &lt;a href="http://msdn.microsoft.com/en-us/library/ms190969(v=SQL.105).aspx"&gt;Understanding Pages and Extents&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The bill is generated from the size of a single replica’s reserved pages, not the size of the data in the replica. Windows Azure Sql Database samples the size of your database periodically over the billing period and your monthly bill is calculated from those samples. How the sampling of your reserved pages is done and how the bill is calculated will be addressed in another blog pox.&lt;/p&gt;  &lt;h2&gt;Metadata&lt;/h2&gt;  &lt;p&gt;Metadata is the data that is kept in the system database on the host server. This includes stored procedures, functions, etc... Meta data is specific to the Windows Azure SQL Database; however it is kept in the system database on the host physical machine. Every user database on the physical host stores it’s metadata in the same system database.&lt;/p&gt;  &lt;p&gt;This data is also replicated to the system database on the secondary physical machines in case a replica needs to be quickly promoted to a primary. In this case, the Meta data is a row level replication and not a page level replication. And just like the user databases, the system database uses pages, and has overhead storage structures required to use the database as well as potentially free space on each page that is currently unused&lt;/p&gt;  &lt;p&gt;At this time there is no way to query for the size of the metadata in the system database.&lt;/p&gt;  &lt;p&gt;In addition to the page data, the bill includes a portion of the metadata. From the system database that is associated with the primary replica on the physical server, we calculate the reserve page size of the system database and divide that amongst the number of rows that the user databases consumes in the system database on that physical server. In other words the metadata proportion is a row level percentage of the user consumption over all the metadata on the physical server. This is the portion of the metadata that is added to the bill.&lt;/p&gt;  &lt;p&gt;Because the total system database’s reserve page size, and the number of total rows on the host system can change, and the primary can failover to another host’s system database, the size of the database’s portion of the metadata can grow or shrink slightly as reported in the bill.&lt;/p&gt;  &lt;h2&gt;Database Maximum Capacity&lt;/h2&gt;  &lt;p&gt;When you set a cap for the database size, both the primaries reserve page size and the database’s portion of the metadata is figured into enforcing that cap. You can read more about setting the maximum size of your Windows Azure Sql Database by reading: &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/ee336274.aspx"&gt;CREATE DATABASE (Windows Azure SQL Database)&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Summary&lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;The bill is based on the size of the reserved pages on your primary partition combined with a portion of the metadata for the physical host in which the database resides. &lt;/li&gt;    &lt;li&gt;Billing samples the size of your database over the billing period and uses those samples to calculate your bill.&lt;/li&gt;    &lt;li&gt;The bill is in part generated from the size of a primary replica’s reserved pages, not the size of the data in the replica. You are not billed for the data in the secondary replicas. &lt;/li&gt;    &lt;li&gt;The bill is in part generated from the database’s share of the system database on the primary replica’s host server.&lt;/li&gt; &lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10361393" width="1" height="1"&gt;</content><author><name>Wayne Walter Berry</name><uri>http://blogs.msdn.com/Wayne-Walter-Berry/ProfileUrlRedirect.ashx</uri></author><category term="Sql Azure" scheme="http://blogs.msdn.com/b/wayneb/archive/tags/Sql+Azure/" /></entry><entry><title>Prevent Data Loss from Force Majeure</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/wayneb/archive/2012/09/17/prevent-data-loss-from-force-majeure.aspx" /><id>http://blogs.msdn.com/b/wayneb/archive/2012/09/17/prevent-data-loss-from-force-majeure.aspx</id><published>2012-09-17T22:49:02Z</published><updated>2012-09-17T22:49:02Z</updated><content type="html">&lt;p&gt;The current Windows Azure SQL Database (formerly “SQL Azure”) &lt;a href="http://www.windowsazure.com/en-us/support/legal/sla/"&gt;service level agreement&lt;/a&gt; specifically has an exception for factors outside Microsoft’s reasonable control, i.e. Force Majeure. Force Majeure is an extraordinary event or circumstance beyond the control of the parties, such as a war, strike, riot, crime, or a natural event (e.g., flooding, earthquake, volcanic eruption). The consequence is that the data center is damaged in such a way that databases can’t be recovered from the replicas or the on-site backups. Currently, Windows Azure SQL Database doesn’t keep any off site backups; this is the customer’s responsibility. The SQL Database team has published an excellent guide for &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh852669.aspx"&gt;Maintaining Business Continuity on SQL Database&lt;/a&gt;, and I encourage customers to read this guide.&lt;/p&gt;  &lt;p&gt;This blog post will show you how to easily create an offsite backup of your Windows Azure SQL database that is hosted in a Windows Azure data center in another region. This type of back up is easily done using Windows Azure Portal to export a Data-Tier Application logical backup file (BACPAC) to a Windows Azure Storage location in another data center.&lt;/p&gt;  &lt;h2&gt;Creating a Copy of a Your Windows Azure Database&lt;/h2&gt;  &lt;p&gt;A BACPAC is a logical backup and does not guarantee transactional consistency. That means if users are writing to your database while the export is taking place, the resulting BACPAC will contain inconsistent data--for example broken foreign key references. Therefore, you need to first create a copy of your database then run the export from the copy.&lt;/p&gt;  &lt;p&gt;Here is how to create a copy of your database:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Connect to your Windows Azure SQL Database server using SQL Server Management Studio.&lt;/li&gt;    &lt;li&gt;Select the database you want to export in the &lt;b&gt;Object Explorer&lt;/b&gt;, right click and choose from the drop down &lt;b&gt;New Query.&lt;/b&gt;&lt;/li&gt;    &lt;li&gt;In the query window type:&lt;/li&gt;    &lt;p&gt;CREATE DATABASE &amp;lt;destination_database_name&amp;gt; AS COPY OF &amp;lt;source_database_name&amp;gt;&lt;/p&gt;    &lt;li&gt;When you execute this command, it will return immediately. However Windows Azure Data will still be executing the copy in the background. You can monitor the copy process by using the &lt;strong&gt;sys.dm_database_copies&lt;/strong&gt; and &lt;strong&gt;sys.databases&lt;/strong&gt; views. Issue the following T-SQL:       &lt;p&gt;SELECT * FROM sys.dm_database_copies;&lt;/p&gt;      &lt;p&gt;SELECT state_desc, * FROM sys.databases;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Once the copy completes, you can use the destination database as the source for the creation of the BACPAC. While the BACPAC is generating don’t execute any INSERTS, UPDATES, or DELETES against it.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;For more information see &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/ff951624.aspx"&gt;Copying Databases in Windows Azure SQL Database&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Finding the Data Center&lt;/h2&gt;  &lt;p&gt;It might have been sometime since the creation of Windows Azure SQL database or someone else created the database and you might not know where it is located. In order to keep your backup in a separate data center from your database, you need to know where the database is located.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Login To &lt;a href="https://windows.azure.com/"&gt;Windows Azure Portal&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Now click on the &lt;b&gt;Database&lt;/b&gt; button on the lower right.&lt;/li&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/4111.clip_5F00_image001_5F00_509CA821.png"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image001" border="0" alt="clip_image001" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/3108.clip_5F00_image001_5F00_thumb_5F00_6A04AB5B.png" width="212" height="41" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;li&gt;In the database main view of the Windows Azure Portal, navigate to the subscription that hosts your database.&lt;/li&gt;    &lt;li&gt;In the properties view on the right hand side it should show the Region      &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/4682.clip_5F00_image002_5F00_1C687EDB.png"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/3527.clip_5F00_image002_5F00_thumb_5F00_15B57558.png" width="203" height="58" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Now that you know where your database is located you can make sure to back up to a different region (i.e. a different data center).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/3122.clip_5F00_image004_5F00_2B132AC0.png"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/1440.clip_5F00_image004_5F00_thumb_5F00_14345944.png" width="628" height="327" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Create a BACPAC backup file Using the Windows Azure Portal&lt;/h2&gt;  &lt;p&gt;The Windows Azure Portal allows you to create a BACPAC. It will not output the package to your local hard drive, instead it writes to a Windows Azure Blob Storage.&lt;/p&gt;  &lt;p&gt;These are the steps for creating a BACPAC from the Windows Azure Portal:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Login To &lt;a href="https://windows.azure.com/"&gt;Windows Azure Portal&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Click on the &lt;b&gt;Hosted Services, Storage Accounts &amp;amp; CDN &lt;/b&gt;Button on the lower right.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/8080.clip_5F00_image005_5F00_087F1212.png"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image005" border="0" alt="clip_image005" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/1452.clip_5F00_image005_5F00_thumb_5F00_21E7154C.png" width="214" height="54" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Once loaded, click on &lt;b&gt;Storage Accounts&lt;/b&gt; in the left top navigation.&lt;/li&gt;    &lt;li&gt;In the main view, choose a subscription and either use an existing Windows Azure storage account or create a new Windows Azure storage account. Make sure that the Windows Azure storage account is in a different region then your Azure database. Copy the &lt;u&gt;access key&lt;/u&gt; where you can get at them later (use notepad) and also &lt;u&gt;the Blob Url&lt;/u&gt; to your storage account.&lt;/li&gt;    &lt;li&gt;You must also create a container inside the selected Blob storage for your BACPAC files by using a tool such as &lt;a href="http://go.microsoft.com/fwlink/?LinkId=253538"&gt;Azure Storage Explorer&lt;/a&gt;. Install this (or another Blob storage tool) and create a container, for this example we are using a container named: &lt;b&gt;dac&lt;/b&gt;.&lt;/li&gt;    &lt;li&gt;Now click on the &lt;b&gt;Database&lt;/b&gt; button on the lower right.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/4111.clip_5F00_image0011_5F00_7B853200.png"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image001[1]" border="0" alt="clip_image001[1]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/3603.clip_5F00_image0011_5F00_thumb_5F00_70C7DAAB.png" width="212" height="41" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;In the database main view of the Windows Azure Portal, navigate to the subscription that hosts your database, then to the server and finally click on the copied version of the database from the steps above.&lt;/li&gt;    &lt;li&gt;In the top toolbar click the &lt;b&gt;Export&lt;/b&gt; button.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/0066.clip_5F00_image006_5F00_71340DA0.png"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/7318.clip_5F00_image006_5F00_thumb_5F00_2470470A.png" width="644" height="96" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Fill out the Export Database to Storage Account dialog.      &lt;ol&gt;       &lt;li&gt;The &lt;b&gt;Login&lt;/b&gt; for the Database Export Settings should be your admin login for your database.&lt;/li&gt;        &lt;li&gt;The &lt;b&gt;Password&lt;/b&gt; for the Database Export Settings should be your admin password for your Azure SQL Database.&lt;/li&gt;        &lt;li&gt;The &lt;b&gt;New Blob URL&lt;/b&gt; for Table Storage Account should be the Blob Url that you noted down in step 4. Prefix with http://, concatenated with a container name and a file name for the location of the BACPAC. There must be a container, you can’t put the file in the root. There must be a file name, something like this:           &lt;p&gt;https://myblobstorage.blob.core.windows.net/dac/exportedfile.bacpac&lt;/p&gt;       &lt;/li&gt;        &lt;li&gt;Double check your blob url and make sure you do not have any spaces, uppercase letters, or special characters in the blob url. Take a minute to get it right and it will save you a lot of frustration.&lt;/li&gt;        &lt;li&gt;The &lt;b&gt;Access key &lt;/b&gt;for Table Storage Account should be the access key that you saved in step 4.           &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/4274.clip_5F00_image008_5F00_2D404F56.jpg"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image008" border="0" alt="clip_image008" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/6232.clip_5F00_image008_5F00_thumb_5F00_0E69DB78.jpg" width="244" height="167" /&gt;&lt;/a&gt;&lt;/p&gt;       &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;The process of creating the BACPAC is submitted asynchronously. You will get an immediate message that your job has been submitted to the queue. Then it can take a few minutes to several hours for the export to complete.      &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/5661.clip_5F00_image009_5F00_2EF11B2A.png"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image009" border="0" alt="clip_image009" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/7713.clip_5F00_image009_5F00_thumb_5F00_4931844E.png" width="644" height="112" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;To check the status, click on the server name in the right hand window and then the status button in the top toolbar. Now fill out the dialog with your Windows Azure SQL Database admin login and password.      &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/0363.clip_5F00_image011_5F00_11CB7320.jpg"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image011" border="0" alt="clip_image011" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/2626.clip_5F00_image011_5F00_thumb_5F00_04D1930F.jpg" width="606" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;If you have done everything correctly, you should see a success message when the BACPAC is finished. You can follow the status of the BACPAC being generated; note that the last update column in the status dialog is UTC.      &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/4263.clip_5F00_image013_5F00_7EF6EF75.jpg"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image013" border="0" alt="clip_image013" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/1033.clip_5F00_image013_5F00_thumb_5F00_5BA9FAD0.jpg" width="644" height="166" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Restoring the BACPAC&lt;/h2&gt;  &lt;p&gt;I am going to save that for a later blog post.&lt;/p&gt;  &lt;h2&gt;Summary&lt;/h2&gt;  &lt;p&gt;With the Window Azure Portal, you can easily create a Data-Tier Application logical backup package (BACPAC) and store it in an offsite Windows Azure Blog Storage account. This will help mitigate data loss from Force Majeure. &lt;/p&gt;  &lt;p&gt;{6230289B-5BEE-409e-932A-2F01FA407A92}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10350274" width="1" height="1"&gt;</content><author><name>Wayne Walter Berry</name><uri>http://blogs.msdn.com/Wayne-Walter-Berry/ProfileUrlRedirect.ashx</uri></author><category term="DacFX" scheme="http://blogs.msdn.com/b/wayneb/archive/tags/DacFX/" /></entry><entry><title>Migrating your Windows Azure SQL Database Using Data-Tier Application Framework (DacFX) Technology</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/wayneb/archive/2012/09/12/migrating-your-windows-azure-sql-database-using-data-tier-application-framework-dacfx-technology.aspx" /><id>http://blogs.msdn.com/b/wayneb/archive/2012/09/12/migrating-your-windows-azure-sql-database-using-data-tier-application-framework-dacfx-technology.aspx</id><published>2012-09-12T18:04:27Z</published><updated>2012-09-12T18:04:27Z</updated><content type="html">&lt;p&gt;This blog post will cover how to migrate your Windows Azure SQL Database (formerly “SQL Azure”) from Windows Azure onto a local SQL Server (box product) using Data-Tier Application Framework (DACFx) Technology and SQL Server Management Studio 2012. Since DACFx is shipped with SQL Server Management Studio 2012 you can &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=29062"&gt;download&lt;/a&gt; both at no cost. This blog will show you how to use the Windows Azure Portal to export a Data-Tier Application logical backup file (BACPAC ) and how to use SQL Server Management Studio 2012 to import that backup file into a local SQL Server instance.&lt;/p&gt;  &lt;p&gt;The reasons for moving from Azure to a local SQL Server instance vary greatly, the most common reason is for testing or development, where you want to test changes locally on SQL Express without affecting your live database. You can also move an Azure SQL Database to a SQL Server instance running in a Windows Azure virtual machine.&lt;/p&gt;  &lt;h2&gt;About Data-Tier Application Framework Packages&lt;/h2&gt;  &lt;p&gt;DACFx technology can be used to create two different types of packages:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;DACPAC Packages with the .dacpac extension currently contain only the database schema, including tables, stored procedures, logins, functions, etc.&lt;/li&gt;    &lt;li&gt;BACPAC Packages with the .bacpac extension contain both the database schema and data.&lt;/li&gt;  &lt;/ul&gt;  &lt;h2&gt;Picking the Right Tools&lt;/h2&gt;  &lt;p&gt;To migrate your database with data &amp;amp; schema, you need have a tool to import a BACPAC package. SQL Server Management Studio 2012 can import BACPAC files and it contains other features for Azure that you will want to take advantage of. SQL Server Management Studio 2008 R2 (the older version of SQL Server Management Studio) cannot import a BACPAC. If you are running SQL Server 2008 R2 you can download SQL Server Management Studio 2012 at no charge, install it side by side with SQL Server 2008 R2, and it will work with your SQL Server 2008 R2 instance. For these reasons, this blog post shows how to use SQL Server Management Studio 2012, the newest version of SQL Server Management Studio.&lt;/p&gt;  &lt;h2&gt;Creating a Copy of a Your Windows Azure Database&lt;/h2&gt;  &lt;p&gt;A BACPAC is a logical backup and does not guarantee transactional consistency. That means if users are writing to your database while the export is taking place, the resulting BACPAC will contain inconsistent data--for example broken foreign key references. Therefore, you need to first create a copy of your database then run the export from the copy.&lt;/p&gt;  &lt;p&gt;Here is how to create a copy of your database:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Connect to your Windows Azure SQL Database server using SQL Server Management Studio.&lt;/li&gt;    &lt;li&gt;Select the database you want to export in the &lt;b&gt;Object Explorer&lt;/b&gt;, right click and choose from the drop down &lt;b&gt;New Query.&lt;/b&gt;&lt;/li&gt;    &lt;li&gt;In the query window type:&lt;/li&gt;    &lt;blockquote&gt;     &lt;p&gt;CREATE DATABASE &amp;lt;destination_database_name&amp;gt; AS COPY OF &amp;lt;source_database_name&amp;gt;&lt;/p&gt;   &lt;/blockquote&gt;    &lt;li&gt;When you execute this command it will return immediately, however Windows Azure Data will still be executing the copy in the background. You can monitor the copy process by using the &lt;strong&gt;sys.dm_database_copies&lt;/strong&gt; and &lt;strong&gt;sys.databases&lt;/strong&gt; views. Issue the following T-SQL:       &lt;blockquote&gt;       &lt;p&gt;SELECT * FROM sys.dm_database_copies; &lt;/p&gt;     &lt;/blockquote&gt;      &lt;blockquote&gt;       &lt;p&gt;SELECT state_desc, * FROM sys.databases&lt;/p&gt;     &lt;/blockquote&gt;   &lt;/li&gt;    &lt;li&gt;Once the copy completes you can use the destination database as the source for the creation of the BACPAC. While the BACPAC is generating don’t execute any INSERTS, UPDATES, or DELETES against it.&lt;/li&gt;  &lt;/ol&gt;  &lt;p&gt;For more information see &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/ff951624.aspx"&gt;Copying Databases in Windows Azure SQL Database&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Create a BACPAC backup file sing the Windows Azure Portal&lt;/h2&gt;  &lt;p&gt;The Windows Azure Portal allows you to create a BACPAC; however, it will not output the package to your local hard drive, instead it writes it to Windows Azure Blob Storage. From Windows Azure Blob Storage, that package can be downloaded on to your local drive and then imported to an on-premise SQL Server.&lt;/p&gt;  &lt;p&gt;Steps for creating a BACPAC from the Windows Azure Portal&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Login To Windows Azure Portal&lt;/li&gt;    &lt;li&gt;Click on the &lt;b&gt;Hosted Services, Storage Accounts &amp;amp; CDN &lt;/b&gt;Button on the lower right.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/3426.clip_5F00_image0014_5F00_4C8CBEF0.png"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image001[4]" border="0" alt="clip_image001[4]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/1768.clip_5F00_image0014_5F00_thumb_5F00_65F4C22A.png" width="214" height="54" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Once loaded, click on &lt;b&gt;Storage Accounts&lt;/b&gt; in the left top navigation.&lt;/li&gt;    &lt;li&gt;In the main view, choose a subscription and either use an existing Windows Azure storage account or create a new Windows Azure storage account. For better performance, make sure that the Windows Azure storage account is in the same region as your Azure database. Copy the &lt;u&gt;access key&lt;/u&gt; where you can get at them later (use notepad) and also &lt;u&gt;the Blob Url&lt;/u&gt; to your storage account.&lt;/li&gt;    &lt;li&gt;You must also create a container inside the selected Blob storage for your BACPAC files by using a tool such as &lt;a href="http://go.microsoft.com/fwlink/?LinkId=253538"&gt;Azure Storage Explorer&lt;/a&gt;. So install this (or another Blob storage tool) and create a container, for this example we are using a container named: &lt;b&gt;dac&lt;/b&gt;.&lt;/li&gt;    &lt;li&gt;Now click on the &lt;b&gt;Database&lt;/b&gt; button on the lower right.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/8780.clip_5F00_image0024_5F00_3B88910D.png"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image002[4]" border="0" alt="clip_image002[4]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/3581.clip_5F00_image0024_5F00_thumb_5F00_6DEC648C.png" width="212" height="41" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;In the database main view of the Windows Azure Portal, navigate to the subscription that hosts your database, then to the server and finally click on the copied version of the database from the steps above.&lt;/li&gt;    &lt;li&gt;In the top toolbar click the &lt;b&gt;Export&lt;/b&gt; button.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/1854.clip_5F00_image0034_5F00_478A8141.png"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image003[4]" border="0" alt="clip_image003[4]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/1351.clip_5F00_image0034_5F00_thumb_5F00_3DA58FD6.png" width="244" height="39" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Fill out the Export Database to Storage Account dialog.      &lt;ol&gt;       &lt;li&gt;The &lt;b&gt;Login&lt;/b&gt; for the Database Export Settings should be your admin login for your database.&lt;/li&gt;        &lt;li&gt;The &lt;b&gt;Password&lt;/b&gt; for the Database Export Settings should be your admin password for your Azure SQL Database.&lt;/li&gt;        &lt;li&gt;The &lt;b&gt;New Blob URL&lt;/b&gt; for Table Storage Account should be the Blob Url that you noted down in step 4. Prefix with http://, concatenated with a container name and a file name for the location of the BACPAC. There must be a container, you can’t put the file in the root. There must be a file name, something like this:           &lt;p&gt;&lt;a href="https://myblobstorage.blob.core.windows.net/dac/exportedfile.bacpac"&gt;&lt;i&gt;https://myblobstorage.blob.core.windows.net/dac/exportedfile.bacpac&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;/i&gt;&lt;/p&gt;  Double check your blob url and make sure you do not have any spaces, uppercase letters, or special characters in the blob url. Take a minute to get it right and it will save you a lot of frustration.&lt;/li&gt;        &lt;li&gt;The &lt;b&gt;Access key &lt;/b&gt;for Table Storage Account should be the access key that you saved in step 4.&lt;/li&gt;        &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/0842.clip_5F00_image0054_5F00_303F7CD0.jpg"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image005[4]" border="0" alt="clip_image005[4]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/1348.clip_5F00_image0054_5F00_thumb_5F00_3F565BAA.jpg" width="244" height="167" /&gt;&lt;/a&gt;&lt;/p&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;The process of creating the BACPAC is submitting asynchronously. You will get an immediate message that your job has been submitted to the queue. Then it can take a few minutes to several hours for the export to complete.      &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/6153.clip_5F00_image0016_5F00_0402F5EC.png"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image001[6]" border="0" alt="clip_image001[6]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/3021.clip_5F00_image0016_5F00_thumb_5F00_6122343B.png" width="244" height="45" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;To check the status, click on the server name in the right hand window and then the status button in the top toolbar. Now fill out the dialog with your Windows Azure SQL Database admin login and password.      &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/8204.clip_5F00_image003_5F00_3AC050F0.jpg"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image003" border="0" alt="clip_image003" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/1447.clip_5F00_image003_5F00_thumb_5F00_14CAA09A.jpg" width="244" height="195" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;If you have done everything correctly, you should see a success message when the BACPAC is finished. You can follow the status of the BACPAC being generated; note that the last update column in the status dialog is UTC.      &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/5141.clip_5F00_image0056_5F00_035A3FC2.jpg"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image005[6]" border="0" alt="clip_image005[6]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/8371.clip_5F00_image0056_5F00_thumb_5F00_0432A5AC.jpg" width="244" height="65" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;  &lt;/ol&gt;  &lt;h2&gt;Importing a BACPAC into SQL Server&lt;/h2&gt;  &lt;p&gt;Now that you have your BACPAC generated via the Windows Azure Portal, you can deploy (or import) it into your on-premise SQL Server using SQL Server Management Studio 2012&lt;/p&gt;  &lt;p&gt;Here are the steps:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Download and install &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=29062"&gt;SQL Server Management Studio 2012&lt;/a&gt;, you can side-by-side install this with SQL Server 2008 R2 if you want. &lt;/li&gt;    &lt;li&gt;Open SQL Server Management Studio 2012 and connect to the SQL Server where you want your data to be imported.&lt;/li&gt;    &lt;li&gt;In the object explorer right click on Databases and choose Import Data-Tier Application.      &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/8765.clip_5F00_image0018_5F00_28C43330.png"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image001[8]" border="0" alt="clip_image001[8]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/8863.clip_5F00_image0018_5F00_thumb_5F00_49B7A5D7.png" width="228" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Click next to get to the second step in the wizard screen. There you have two choices: use a BACPAC from the disk, or download one directly from Windows Azure Blob storage. Since our package is on Blob Storage, let’s download from there. On the Import Settings page of the wizard, select the Import&lt;b&gt; from Windows Azure&lt;/b&gt; radio button.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/7612.clip_5F00_image0034_5F00_67793096.jpg"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image003[4]" border="0" alt="clip_image003[4]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/7282.clip_5F00_image0034_5F00_thumb_5F00_2240D96D.jpg" width="244" height="226" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Another dialog will appear to collect your connection information. Enter in your storage account name on Windows Azure Storage where the BACPAC was placed and the Windows Azure Storage Account Key (Primary Access Key). Then click &lt;b&gt;Connect&lt;/b&gt;.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/8666.clip_5F00_image004_5F00_34F5D324.png"&gt;&lt;img style="margin: 0px; display: inline; background-image: none;" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/2818.clip_5F00_image004_5F00_thumb_5F00_35620619.png" width="244" height="92" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;SQL Server Management Studio 2012 will traverse and find your BACPAC, if it doesn’t find the right one, use the &lt;b&gt;Container&lt;/b&gt; and &lt;b&gt;File name&lt;/b&gt; drop downs to choose the Data-Tier application package you want to install. Click the &lt;b&gt;Next&lt;/b&gt; button on the Import Setting page.&lt;/li&gt;    &lt;li&gt;The next page of the wizard is the Database Settings. Here you can enter your database name, the location of the database data file and transaction log files. Then click the &lt;b&gt;Next&lt;/b&gt; button.       &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/7774.clip_5F00_image006_5F00_23F1A541.jpg"&gt;&lt;img style="display: inline; background-image: none;" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-35-metablogapi/8688.clip_5F00_image006_5F00_thumb_5F00_579A119F.jpg" width="244" height="226" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Review the summary page and click the &lt;b&gt;Finish&lt;/b&gt; button.&lt;/li&gt;    &lt;li&gt;In the Results page, the BACPAC will download from Windows Azure, a database will be created, and your schema, data, stored procedures, etc will be imported into the new database.&lt;/li&gt;  &lt;/ol&gt;  &lt;h2&gt;More Fun…&lt;/h2&gt;  &lt;p&gt;Your BACPAC from Windows Azure blob storage was downloaded into the Temporary location specified in the Import Settings page. You can save that package off for a backup of your database. Another fun thing to do is rename the extension from .bacpac to .zip, then open it up and look at the Xml files inside. But note that editing the XML files directly is not supported and your package may be rejected by the tools if you make any changes to the XML.&lt;/p&gt;  &lt;h2&gt;Summary &lt;/h2&gt;  &lt;p&gt;With the Window Azure Portal, you can easily create a Data-Tier Application logical backup package (BACPAC), store it to your Windows Azure Blog Storage; and then, using SQL Server Management Studio 2012, you can import that package to your local database server.&lt;/p&gt;  &lt;p&gt;{6230289B-5BEE-409e-932A-2F01FA407A92}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10348758" width="1" height="1"&gt;</content><author><name>Wayne Walter Berry</name><uri>http://blogs.msdn.com/Wayne-Walter-Berry/ProfileUrlRedirect.ashx</uri></author></entry></feed>