MSDN UK Team blog

Get all the latest Microsoft developer news, tools, downloads, tutorials and tips right here, every day.
Search Form
Unfiltered HTML
Developers code with microsoft

Guest Post: Orchard on Windows Azure

Unfiltered HTML
Unfiltered HTML

Guest Post: Orchard on Windows Azure

Rate This
  • Comments 2

RichardGarsideRichard Garside is a freelance .NET developer working mainly with .NET MVC, Orchard and Windows 8. He recently became an award winning Windows 8 developer for his app Font Picker, but he doesn’t like to boast about it. He is also a founding and managing member of Leeds Sharp, a user group for .NET developers in Leeds.

Orchard is an open source CMS created by Microsoft on top of ASP.NET MVC. Orchard has a very powerful extension model and a very flexible theming system that lets you customise how it looks. There’s a growing community of developers around Orchard and an ecosystem of free modules and themes.

If you’d like to run Orchard on Windows Azure then you have two options. The easiest is to use a Windows Azure Website. Orchard can also be run as a Windows Azure Cloud Service and will store media files in blob storage if it’s running in this mode.

If Orchard is running as a Windows Azure Website then you can install new modules and themes using Orchard’s web admin interface. However, if Orchard is running as a Windows Azure Cloud Service then all modules and themes will need to be installed in your development environment and deployed to your live environment using an Azure Package. For detailed instructions on deploying to Orchard Cloud Service you can read the Orchard Documentation on Deploying to Azure.

In most cases a Windows Azure Website is the most suitable Azure service to use for Orchard. Out of the box Orchard running as a Windows Azure Cloud Service does not offer you any features that it wouldn’t running as an Azure Website, and Azure Websites can be easily scaled by adding extra instances.

If you’re thinking of using Orchard as the base for your web app and you’d like to make use some of the many Windows Azure Cloud Service features such as the worker role, blob storage and the service bus then this would be the perfect time to use Orchard Cloud Services. You can then create Orchard modules that require the Windows Azure Cloud Service API and then create and deploy an Azure package.

Running Orchard as a Windows Azure Website

So, you’ve decided that an Windows Azure Website is the perfect hosting environment for your new Orchard website. Once again you have two options of how to get started.

The quickest is to use the Windows Azure Websites Gallery. This is perfect if you’re not doing any custom module development as you can install any extra modules you do need through Orchard’s Module Gallery. Even if you are doing custom module development, it’s a quick way to get started and you can deploy your own modules and themes using either Orchard’s module/theme admin pages or using a remote website in WebMatrix using Web Deploy.

If you’re doing custom module development you should use the source version of Orchard (rather than the web version) and do your development locally in Visual Studio. When you’re ready you can build your own web version and use Web Deploy and WebMatrix to deploy this to your server. You can also use the web version in WebMatrix to test your site locally before deploying to Windows Azure.

Installing Orchard using the Windows Azure Web Gallery

Using the Windows Azure Web Gallery is an incredibly easy and quick way to set up Orchard. Orchard can be run from a SQL Compact database file, but we’re going to create a new SQL Azure Database.

Log into the Windows Azure Portal and go onto the SQL Databases tab. Here you can create a new database following a straight forward wizard. Once the database is connected you’ll need the connection string. You can find this on the details page for your new database when you click ‘Show connection strings’.

01 Connection Strings

Make a note of the ADO.NET connection string and where it says {your_password_here} fill in the password you set for this database.

Now go to the Websites tab, click new website and click ‘From gallery’.

02 New from gallery

The gallery is full of good stuff. You’ll find Orchard under Contentmgmt.

03 New Orchard

Once you’ve selected Orchard you’ll be asked to specify your site’s URL and what region of the world it should run in. Then Windows Azure will create your new Orchard website. This normally takes around a minute.

Once this is complete you can navigate to your site’s homepage where you’ll be presented with a setup screen where you specify the name of your site and the database to use. As we’re running from an Azure SQL Database this is where you’ll need the connection string you made a note of earlier.

04 Orchard Setup

Now Orchard is installed you can go to the Dashboard, create new content and install modules and themes. I’ve installed the Metro theme.

05 MetroAzure

Installing Orchard on Windows Azure from the Source

When using the Orchard source version should download the latest version from the Orchard Project Site, or if you’d like to keep up with the latest bits you can enlist to the source code version. The source version has the full Visual Studio project for Orchard and will let you build modules and test Orchard in Visual Studio. When using the source version you need to do some extra build steps to create a version ready for your live site.

Those steps create a folder in your build. In that folder navigate to MSDeploy/Orchard. This is the compiled web version of Orchard. You could deploy these files to your site, but the Web Deploy tools available in WebMatrix give us a much nicer method.

If you haven’t already create a new Windows Azure Website using the ‘Quick create’ link. This creates an empty Azure Website.

Open the Orchard Web version folder as a WebMatrix Site. Then click Publish and then select ‘Import publish profile’. You can download the publish profile as a file from the Azure Portal page for your new site.

Once publish is complete you will be able to navigate to your site’s homepage and setup the database connection for your site. Orchard should then be ready to roll along with any of the custom modules and themes you have installed. If you want to streamline this deployment process you might want to look at the Orchard Recipes feature which lets you create an install recipe that will enable any required modules on setup.

Conclusion

When running Orchard on Windows Azure you have many options open to you. In most cases you’re best off running Orchard as an Azure Website. I hope this article gave you a good idea of how to set this up. For more information about Orchard and extending Orchard by writing your own modules you should refer to the Orchard Documentation.

  • Nice writeup! However, I think your statement about Orchard running in Azure Cloud Services not offering any features above Azure Web Sites needs to be expanded upon. Running Orchard in a Cloud Service, while not as quick and easy to set up, does have the following advantages:

    1. Web Sites do not support custom SSL certificates yet, so if you want to use SSL with your site you're stuck with using the ".azurewebsites.net" domain.

    2. Web Sites lack the staging/production slot capabilities and instantaneous VIP-swapping of Cloud Services. These are handy when doing upgrades, as you can upload a whole new version of your service, test it out, and then VIP-swap in into production with a single fast operation while retaining the same public IP-address of your service, etc.

    3. With Cloud Services you can do more advanced deployment stuff like installing perf counters, registering COM components and manipulating the registry, should you have those requirements.

    4. With Cloud Services you can remote desktop into the underlying VM and do much more advanced troubleshooting and diagnostics.

    As a side note, in Orchard 1.7 the Azure Cloud Service deployment configuration will be updated to the latest version of the Azure SDK. This has already been committed to the 1.x branch.

  • Thanks for this write-up.

    Weirdly, after I created the Orchard website from the gallery, I couldn't get it to connect to the Azure SQL database using the connection string that Azure gave to me.

    What I did to fix it was to connect to the database in the VS2012 Server Explorer and then use the connection string from the VS2012 properties window.

    I thought I'd post here in case it helps anyone else.

Page 1 of 1 (2 items)
Leave a Comment
  • Please add 4 and 3 and type the answer here:
  • Post