Random Ramblings About Making Games and Stuff from Cloud

Archive for the ‘Uncategorized’ Category

Azure SQL Backup and restore scenarios using bacpac export/import

What Azure SQL was missing was a proper supported way to make backups for disaster scenarios. Those scenarios would include loss of control over Azure SQL server or human error causing SQL admin to delete whole Azure SQL server. Great news everyone Azure SQL now has tools to mitigate the impact of these scenarios. SQL Azure Import/Export Service CTP is now available. More details on how this works can be found here.

What do you need?

You need means of scheduling backup, Azure Storage account where to put bacpac files, means to get the exact url of bacpac file and a Azure SQL account to backup.

Azure Account

You need one Azure account with Azure SQL and Storage server of course. 🙂

You might want to have separate backup storage account because, if you cannot access your production account you still have access to your backups. I personally download bacpac backups from Azure to local server.

Bacpac file export tool

In this example I will use Red-gate backup tool. This is because this tool allows you to easily make a database copy of your database before the backup. This will allow you to make transactionally safe backups.

But you can also use DAC SQL Azure Import Export Service Client V 1.2. In this tool you need to make a database copy using for example Cerebrata cmdlets.

Azure Storage account browser

You can use any tool you like. In this example I will use Azure Storage Explorer because it is free 🙂

Windows server

Ideally this would be dedicated windows 2008 server so that you can be sure that it runs smoothly. You can also download exported bacpac files to this server. Just to be safe 🙂

Backup using Red-Gate command line backup tool

Here is a nice how to video how to setup scripts using Red-Gate tool. NOTE that in this video script will make a backup into different database. What we want to do is schedule a bacpac file generation. If you want to test how bacpac file generation works without command line watch this video.

But back to business: your scheduled script should look something like this:

RedGate.SQLAzureBackupCommandLine.exe  /AzureServer:[url_to_azure_server]  AzureDatabase:[databasename] /AzureUserName:[db_owner_username] /AzurePassword:[password] /CreateCopy /StorageAccount:[Azure_account_name] /AccessKey:[primary_or_secondary_azure_storage_key]  /Container:[container_name_in_storage] /Filename:[filename_of_bacpac]

Notice that I did not use any real values in above script. Just fill in the parameter between [ ] and schedule this script to as often you like. Note that you need to change the file name on every run because over writing with a same file name is does not work. I use date+time combinations.

So now we are ready for disasters 😉 Next I will explain how to perform a restore to totally new Azure SQL server.

Restore using Windows Azure management portal

When you need to restore a database to new server you need to have access to bacpac backup file in Azure storage account.

  • Firstly create new Azure SQL server. How to video of that is here.
  • Secondly and this is important add same database logins that the backedup database had. Azure SQL user management is explained in detail here.
  • Thirdly get url of the pacbac file using Azure Storage Explorer. Open Azure Storage Explorer and login to storage account containing the bacpac file. Select the bacpac file and press view button. That is explained in the video of next step.
  • Fourthly you are ready to restore! It can be done like explained in this video.

If you have any comments or questions please don’t hesitate to ask.

Thanks for reading and happy backupping!

Advertisements

Clouding IKEA Style! Design the Price Tag First.

We developers, and an industry, should start to rethink how we start designing our Cloud Services. The customer centric design is old news. SaaS entrepreneur Rainer Stropek, whom I met in Berlin, said wisely: “Do pricing like IKEA! First design the price tag.”

The decision to purchase your service should be almost subconscious for the customer.

While working in my startup Sopima I have learned that there are three reasons for this. I will discuss these findings in TechDays 2011 so please come and listen – you can also ask me questions, for example via Twitter: tweet your questions and comments to me in advance @anttimakkonen and I’ll try to answer you. But now let’s go back to business. Read on how to make the price tag your first priority.

Reason number 1

You will not win your battle for customers by being the nicest and prettiest service of its kind in the minds of the Internet dwellers. Because of Cloud Services like Amazon (IaaS) and Windows Azure (PaaS) there’s more competition on your way and with a speed you are not accustomed to. It is really easy to put up a service once you bypass the initial learning curve of any Cloud provider. Most of the problems you will face when building your service are not technical. Customers are not interested in what technical solutions you have mastered. They want a polished service experience that does the basic stuff extremely well.

Reason number 2

The decision to purchase your service should be almost subconscious for the customer. Customers that are lured into the web page of your service need to understand what the service is and what the cost is, in a short time before they leave the page. Otherwise you just paid for a lead that is not going to transform to a customer.

In software design this means that you need to design the billing of your product in a way that the customer understands what he or she is getting. For example, do not make him pay for upload/download bandwidth but instead the total size of stored files per month. Keep rates simple not complex. You need to work a little extra to calculate what a customer normally needs. Do not force customers do that calculation. In addition, customers do not like surprises in their bills. Lots of SaaS entrepreneurs prefer to sell prepaid credits or similar to get commitment, and some money fast. In my experience it is easier to purchase “packets”, but don’t overdo the number of options. Calculating costs and prices takes us further to the next reason.

Reason number 3

Computing resources and scalability are no longer major investment decisions. You just order what computing resources you need and you can easily cancel that order when you are done with it. Basically you can run as bad code in the cloud as you wallet can stand and your service will still scale. 🙂

In the age of Cloud Computing you need to direct your attention to what cloud service provider is charging you and minimize that cost. After you have made your service stateless, the cost is the only limitation to scale your service up. You need to optimize and monitor your cost structure – and sometimes even make ‘strange’ design decisions, if that helps you to pull your Cloud costs down. This is even more important if your service revenue streams are dispersed and the profit margins are lean.

As a final thought I’d like to say

Consider billing as an integral part of your service. Do not make customer reconsider his purchase on every obscure bill you send. Especially if you are making a subscription service, do not implement your own billing! Trust the professionals and consider using some of the readymade services like these:

PS. I found these tools that will help you on estimating, monitoring and minimizing Azure costs.

%d bloggers like this: