Azure Databases – What do you need to do if you have a local database and you want to deploy it to Azure? I saw while researching for this article that there were a few ways to do this.
Looking for something else? Try these links instead:
- Customizing SQL Server Status Bar – Know Your Connection
- Automate Standard Comment Blocks For New SQL Queries
- Easily Generate Table Change Scripts In SQL Server Management Studio
- Execute Script Error Resolved In SQL Server Management Studio
- ApexSQL Provides Excellent SQL Tools For Free
The method I’m going to show you now, is a nice quick and easy method.
Azure Databases Created From Local Copy
To illustrate this I created a SQL database on Azure. Just select the Quick Create option.
Enter a suitable name for the database, select your subscription and server.
Your newly created database will now be listed under your databases list on Azure. Click on the database name.
You will now see the database dashboard, and to the bottom you will see the server name listed.
Fire up SQL Server Management Studio
Start your copy of SQL Server Management Studio and connect to your server as set up on Azure, entering the server name and Login credentials.
SQL Server Management Studio will now list the database you created earlier on Azure. As you can see, there are no tables yet.
The next step is to connect to your local SQL Server instance.
Once you have done that, you will see your Azure and the Local SQL Server instance listed. Expanding the local database tables, you will see the tables we want to script on the Azure instance.
Right click the local database and select Tasks -> Generate Scripts.
The script generator will now start. In this instance I have selected to script the entire database.
Before you create the script, click on the ‘Advanced’ button.
Under the advanced options, be sure to select to script the database for SQL Azure.
In my example, I chose to only script the schema but you can script the schema and or data.
After you are done, create the script.
Selecting the Azure Database
The next step is to select the Azure database in SQL Server Management Studio and drop the script file in the editor window to open the script up against the Azure database.
Hit F5 and execute the created script.
When the script execution completes, you will see the created database tables in the Azure database.
And to make sure that it all worked, log on to your Azure server and view the tables on your Acme database.
As you can see, getting your local database on Azure is really simple and all the tools are built right in to SQL Server Management Studio.