This project is read-only.

Migrate Site Media/Images from Local Physical Storage to Azure Blob Storage - Relative Image Paths in Content Break

Topics: Installing Orchard, Troubleshooting
Oct 1, 2012 at 11:07 PM
Edited Oct 1, 2012 at 11:16 PM

I'm migrating a site up into Azure using Orchard ClickToBuildAzure. Everything seems to work great from a content standpoint.

However, none of my media was pulled up into Azure Blob storage. A minor inconvenience, so I thought I'd upload a zip of my images to Media (in a way to retain my folder structure) and the images uploaded just fine, but now ALL of the image paths in my site are wrong. All of my image paths are relative (~/Media/Default/Images/image.jpg). 

Is there a best-practices for migrating images up into Azure Blob without having to go back and manually (or via script) update all of the image paths in my content to What I'd like to see is a way to get my images into Blob and all of my images (in content) throughout my site just start working.

Adding the images to my Theme isn't a solution because i need the images to be dynamic - part of the CMS solution - where a user can add/delete. 

Oct 1, 2012 at 11:26 PM

Would you like to try to use Azure Web Sites instead of Azure Cloud Services ? It would be easier for you. Cloud Services adds some level of complexity that a typical Orchard website doesn't need.

Oct 1, 2012 at 11:48 PM
We'd really like to use Cloud Services if possible. I've deployed Orchard as a web site and it works great, but now we'd like it done via cloud services.

Any tips to get me in the right direction?

On Oct 1, 2012, at 5:26 PM, sebastienros <> wrote:

From: sebastienros

Would you like to try to use Azure Web Sites instead of Azure Cloud Services ? It would be easier for you. Cloud Services adds some level of complexity that a typical Orchard website doesn't need.

Oct 2, 2012 at 12:21 AM

If you use ClickToBuildAzure then the package will contain the modules and the configuration right so that Blob storage is used. So if you upload a new Media it will definitely be  in it and not on the file system. Are you using the package which is generated and not deploying from visual studio instead ?

Oct 2, 2012 at 12:46 AM
Edited Oct 2, 2012 at 1:00 AM

I am using the package that is generated by using ClickToBuildAzure - following the instructions verbatim from

I build the package and update the configuration as instructed in the tutorial, and you're right - all modules are included, and any new Media that I add to my Azure Cloud Services site once it is setup is added to Blob storage. My problem-case is this:

  • I have a Dev Orchard web site (hosted locally in IIS) 
  • I have added content to this local site (including Media)
  • Using the MediaPicker Field, I choose images from the Media storage to place into content
  • I have exported the content from my Dev site to XML using the Import/Export module. The image paths are all relative paths (~/Media/Default/etc)
  • I have now built and deployed an Azure Cloud Services instance of Orchard and have imported my content via XML (including pages, projections, HTML widgets, etc)
  • Azure creates one URL for Cloud Services and creates another URL for Blob Storage.
  • The site's base URL becomes:
  • None of the Media that I loaded into my Dev site was migrated to Blob automatically when I loaded the Azure package (though I'm not sure that it's supposed to)
  • When I manually add new Media, they are stored in Blob just fine, but my content is expecting to find images at ~/Media/Default/etc and that does not exist
  • The Blob Media URLs are all
  • Relative image paths try resolving to the cloudservices url, but the images are actually stored at the Blob URL. 

How can I migrate Media from local Dev to Cloud Services and retain my image mappings?

The only solution I know of so far is to Find/Replace image paths in my exported XML and update all to the absolute Blob path.

Tips for a more elegant approach would be appreciated.

Maybe a way to add a site setting (maintainable in the UI) and tap into Orchard Core to route relative image paths to the Blob path instead of the Cloud Service path? Any tips at all would be helpful.

Oct 2, 2012 at 1:12 AM

Ok, it's an import/export issue then. I would say that your best option right now is to replace the urls as you suggested.

Oct 2, 2012 at 1:16 AM

Thanks. I'm ok with that. I may play around with writing a little export assistant for these types of scenarios, but in the meantime CTRL-H will get the job done.

Oct 2, 2012 at 1:25 AM

I found this module. I might try it out. The description talks about my issue.