Friday, March 15, 2013

Host your Web Application to Windows Azure

There are different ways you can host web application to Windows Azure. One of them are hosting application from Visual Studio. I have used VS 2012 to deploy the web application. This particular web application is using SQL Server 2008 as database.

When you have web application with database then first you should import database to Windows Azure. You will find more details about how you can import database to Azure :

From the above URL , you will find  "You must also create a container inside Blob storage for your BACPAC files by using a tool such as the Windows Azure Management Tool (MMC) or Azure Storage Explorer."

In my post, I wanted to avoid installing tool for creating the container since  I have seen Windows Azure Management Tool (MMC) is removed from codeplex and a little bit old.

So my process was like below:

1) Make a SQL script from my SQL Server
2) Run the query in Azure SQL
3) Download publishing Profile
4) Deploy from Visual studio 2012

1) Make a SQL script from my SQL Server
Make script from the database,
Make database Script

2) Run the script in Azure SQL

First login to Azure account by clicking portal:

Second, find your database that you have created inside Azure

Third, find the MANAGE URL from tHE DASHBOARD 

Fourth, Login to the manage url and paste the script to the sql query 

Run Script in query window

After running the script you will find an error, you need delete ON [PRIMARY] from the script to avoid the error

3) Download publishing Profile

Login to Azure management portal and download the publishing profile for your website/Application.
Download publishing profile

4) Deploy/Publish from Visual studio 2012 to Azure

Open your project in VS 2012 and click publish button and then you will find option to import publishing profile option:

Import publishing profile in VS 2012

Follow the wizard and complete the publishing of the web application.

Publishing wizard

Now you will be redirected to your website in Azure.