Microsoft Azure Web Sites allows you to have a virtual directory created within the site. There are many advantages to this. Consider a scenario where you your org’s site is deployed to root http://.azurewebsites.net</a>. You now want to have separate branches for different departments within your org. For example:
</span>

  • http://.azurewebsites.net/marketing</span></a>
    </li>
  • http://.azurewebsites.net/sales</span></a>
    </li>
  • http://.azurewebsites.net/hr</span></a>
    </li> </ul> Another example could be where you would want to setup a blog within your site. In this article I will demonstrate to deploy wordpress to virtual directory called BLOG within my site.
    Here is my current set-up.
    * SiteName: Kaushal
    * HostName: kaushal.azurewebsites.net
    * Application: ASP.NET MVC
    * No databases are currently linked to my site
    I would host the wordpress under my site so that it is accessible under
    http://kaushal.azurewebsites.net/blog. Here is what we need to do.
    1. Create a virtual directory within my site called BLOG via azure portal and link a MySQL database to this site.
    2. On my Local Machine, download and install WordPress via WebMatrix and deploy it to the virtual directory we created above.
    Sounds easy right? Let’s go ahead and deploy it.
    # Microsoft Azure Portal
    * Logon to Azure portal.
    * Go to the CONFIGURE page for the site and scroll to the virtual applications and directories section at the bottom of the page.
    *
    Add an entry as seen in the below image:

      * Click on SAVE.
    * Now go to the LINKED RESOURCES page and link a MySQL database to your site.

    NOTE: Choose an existing MySQL DB or create a new one. Let’s say you already have a free
    MySQL DB associated with your subscription but you want a separate MySQL database for the application. You will have to purchase a plan from CLEARDB for this

     

    * Once, linked. Go to the DASHBOARD page.
    * Under quick glance section a hyperlink called View connection strings will be created.

    NOTE: You could retrieve the connection string parameters from the LINKED RESOURCES page too. Click on MANAGE in the bottom pane for the site. This will redirect you to ClearDB site which will provide you with the following

    • Database
    • Data Source
    • User Id
    • Password

     

    *
    Download & save the publishsettings file for the website by clicking the hyperlink “Download the publish profile” under quick glance section of the DASHBOARD page.

    # Local Machine
    * Launch Microsoft WebMatrix
    *
    Click on New -> App Gallery

    *
    Select WordPress from the App Gallery and click on Next.

    * This will take you to through the WordPress setup.
    *
    Accept the EULA by clicking on “I ACCEPT

    *
    Once done it will start downloading the contents to your local machine (C:\Users\\Documents\My Web Sites\WordPress</strong></span>)
    </div>
    *
    During these process it allows you to configure certain application parameters as shown below:

    *
    Once you specify the parameters and click on Next it proceeds with the installation.

    * Once installed, click on “Copy user names and passwords“. This will copy the details to clipboard which you could save in a text file.
    * Click on OK.
    *
    *
    Now click on Publish

    * This will prompt you with another window.
    *
    Click on Import publish profile and point it to the location where we saved the publishsettings file we downloaded earlier.

    * Once selected, it will auto-populate the parameters from the publishsettings file.
    *
    We need to modify the following sections as shown below:
    * Site name: kaushal\wordpress (physical path location relative to the root site)
    * Destination URL: http://kaushal.azurewebsites.net/blog
    (virtual directory name)

     

    NOTE: Don’t chose FTP
    as the protocol as it doesn’t allow you to publish databases.

     

    * Click on Validate Connection. Once validated, you will see the confirmation.
    * Click on Save.
    * This will take you to the Publish Compatibility page. Click on Continue.
    * Once compatibility check has been performed. Click on Continue again.
    *
    It will display the list of files that will deployed to the server.

    *
    Click on Continue to start the deployment.

    * Once publishing is completed you could open the log file and analyze.
    *
    Click on the hyperlink as shown below to browse to the site:


    HTH,
    Kaushal