Running Magento on Azure Websites

Introduction

Magento is a powerful eCommerce system and in this post, we're going to explore installing Magento Community Edition on an Azure Website.

Create website

Login to the portal and create a new empty Azure website with a MySQL database. Note that you will most likely need to scale the website to at least Basic and the free MySQL database from ClearDB will run out of space.

Download Magento

Option 1

There are several ways you can do this. You can download the Magento full release package zip file to your computer, unzip and upload it but this will take a LOT of time since there are thousands of files to upload.

Option 2

Another way would be to use the Magento downloader then following the installation instructions.

Option 3

A third option which I opted in-to, is to use the Kudu Diagnostic Console that comes with every Azure Website to download Magento directly to my website and unzip it.

Open the console by going to http://yourwebsite.scm.azurewebsites.net/DebugConsole

You will be presented with this nice pseudo-console where you can do some neat stuff.

Download

Navigate to home\site\wwwroot and download Magento by doing a curl -o magento.zip http://www.magentocommerce.com/downloads/assets/1.9.0.1/magento-1.9.0.1.tar.gz
optionally, also download the sample data
curl -o sampledata.zip http://www.magentocommerce.com/downloads/assets/1.9.0.0/magento-sample-data-1.9.0.0.zip

Unzip Magento

unzip magento.zip and grab a coffee, this will take a while.

Install the sample data

Extract the sample data unzip sampledata.zip

Copy the magento-sample-data-1.9.0.0\media folder into the magento folder then additionally copy the magento-sample-data-1.9.0.0\skin folder into magento folder.

cp -r magento-sample-data-1.9.0.0\media magento cp -r magento-sample-data-1.9.0.0\skin magento

Import the sample database data

Connect to your MySQL instance (in my case, this was running on ClearDB) and run the sample script to insert data into the database
mysql --user=yourMysqlUsername --password=yourMysqlPassword -=host=yourMysqlHost yourDatabaseName < magento-sample-data-1.9.0.0\magento_sample_data_for_1.9.0.0.sql

Run Installation Wizard

After completing the above steps, open http://yourwebsite.azurewebsites.net/magento/ in a browser window where you will be presented with the Magento Installation Wizard

Configure database connection

Enable Web.config based URL Rewriting

Using your favorite text editor, create a Web.config file with the content below

then upload it to the root of your website (wwwroot).

Done

You have now installed Magento on Azure Websites!