Back up and restore. Azure hidden corners.

Hello everybody, If you wanted to back up your database in Azure and then restore it you`ll like this post. It seems all the tutorials there somehow do not cover this simple way of backing databases. Microsoft Azure is one of the places to create your website and simple enough platform to manage it. But backing up and restoring database there is not so easy and intuitive. There are a number of ways to handle database (DB) in Azure. It can be done programmatically, it can be done with the help of Azure feature of backing and restoring or it can be done manually. Today`s post is all about backing up and restoring databases in Microsoft Azure cloud platform manually. Before we can proceed there is a number of prerequisites to be fulfilled. Pay attention that below software is free except of paying for database in Azure. More details about pricing here.

  1. You`ll have to create Azure account to be able to create there web site. One detail that be aware of when creating an account you`ll need to provide credit card details even when you open free preview account.
  2. Some version of Visual Studio say VS Express 2013 for Web to code your website using your technology of choice say ASP.NET MVC 5.
  3. Than create there your website and then attach to it SQL database.
  4. Next you`ll need to install MS SQL Server 2012 Management Studio Express(SSMS) or later version to manage databases.
  5. One last thing is to Link SSMS to SQL Azure to be able to import/export SQL DB manually from and to Azure.

OK. That`s say you`ve created a website in Azure. In addition you created a website in Visual Studio targeting SQL database in Azure. To deploy your database there is a need to update connection string in Web.config file in your solution.

 

Where Source=ServerName; Initial Catalog=TargetDatabaseAtAzure. Detailed explanation on how to configure this string here. In general connection string is taken from Azure.

Working with multiple migrations in ASP.NET MVC 5. Based on Pluralsight course by Scott Allen

1.  Add migration to relevant folder

Add-Migration -ConfigurationTypeNameBooks.Web.DataContexts.IdentityMigrations.Configuration “UpdateX”

2. Update development/production database (change connection string)

update-database -ConfigurationTypeNameBooks.Web.DataContexts.IdentityMigrations.Configuration -verbose

Backup and restore Azure SQL database with MS SQL Server 2012 Management Studio Express.

Backup

1. Open SSMS.

2. Connect to local server.

3. Right click on Databases folder->Import Data-tier Application

3.1 SSMS have to be configured for connection to Azure SQL

(get connection string to Azure DB from Azure)

4. Next-> Import form Windows Azure. Etc.

To restore DB from SSMS to Azure.

1. Open SSMS.

2. Connect to Local server.

3. Right click on the DB to be imported ->Tasks-> Deploy database to SQL Azure

4. Connect to Azure server.

5. Deploy SQL database.

It is good to know that today`s Azure has a new feature of DB backup and restore built-in.

Java Code Geeks

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.