Click here to Skip to main content
15,742,655 members
Articles / Hosted Services / Azure
Posted 28 May 2017

Tagged as


1 bookmarked

Upload Contents to Azure Container, CDN in WordPress Folder Format

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
28 May 2017MIT5 min read
How to upload contents to our Azure container in our CDN storage in a WordPress folder format

Table of Contents


Here, in this article, we are going to a see how we upload contents to our Azure container in our CDN storage in a WordPress folder format. You may be thinking what is so special in WordPress folder format, what makes the difference in other formats? When I say WordPress folder format, I mean one folder in an another folder. In WordPress, we usually have the structure as wwwroot/wp-content/uploads/2017/05/. The real problem is, we cannot create a container inside a container. Yeah, you heard it right. But, you don’t need to worry about it, there are always few ways in which we can achieve this requirement. In this post, I am going to show you that. I hope you will like this. Now let’s begin.


I recently created a Azure CDN for my website, and when I was just trying to upload the files to my Azure storage, I got stuck with the problem, that we cannot create a container inside a container.

Image 1

Figure 1: No option to upload a container inside a container

If it is possible, changing URLs of my entire images and other contents would have been pretty much easier, hope you know what I mean? We could have just uploaded the root folder and changed the main URL to our CDN endpoint. In my case, changing the URL to could fix the issues, and with some plugins, we can easily do that.

In this post, we are going to see two possible solutions we can use:

  1. Use “/” in the Azure blob
  2. Upload the folders via tools like Storage Explorer

Use “/” in the Azure blob

One good thing here is we can always create virtual folders by having the “/” character as a delimiter/part of the blob name to build the hierarchy we need. In our case, it is wwwroot/wp-content/uploads/2017/05/. Though the Blob service in Azure storage is based on flat storage scheme, not a hierarchical scheme, we can still specify a character or string delimiter within a blob name to create a virtual hierarchy. For example, we can always create unique blobs as follows:

  • /SibeeshPassion.png
  • /2017/01//SibeeshPassion.png
  • /wp-content/uploads/2017/01/SibeeshPassion.png

You can follow this post for getting more information about this.

Upload the Folders via Tools like Storage Explorer

This step is much easier than the above mentioned way. Here, we are going to use the tools like Storage Explorer to do the task for us. Uploading each of the contents manually and renaming them in hierarchical format would be a tough task, am I right? If you are having around 20-50 images or contents in your site, that won’t be a problem. But my case was a bit different, as I had around 5000 images and other content, so I personally selected this method.

To get started, you will have to download the tool, Microsoft Azure Storage Explorer. Once you download, please install it and open it.

Now, add your Azure account in Storage Explorer.

Add Account in Microsoft Azure Storage Explorer

Figure 2: Add Account in Microsoft Azure Storage Explorer

Once you add your account, the tool wish list down all of your storage and resources you have with that account. Now go to your storage account and create a container. Let’s create and name our container as wp-content.

Creating a BLOB Container

Figure 3: Creating a BLOB Container

Now what is pending from our end is, uploading the folders. Let’s create one sample folder with one image.

Files and Folders to Upload

Figure 4: Files and Folders to Upload

Now click on the upload button and select the root folder you need to upload.

Select the Folder to be Uploaded

Figure 5: Select the Folder to be Uploaded

Once you are done uploading, I am sure that you can see those files in your storage account. Please note that it follows the same hierarchy we needed.

Select the Uploaded Files

Figure 6: Select the Uploaded Files

Now if you just copy the file URL and open it in the browser, you can see the content you have just uploaded.

Please note that the default access policy of a container is private, thus you will not be able to load the contents via browser. Most probably, you will be getting a 404 error. To fix this, you will have to change the access policy wither to blob or container. You can follow this post: Fix For 404 ResourceNotFound Error After Uploading to Azure Container

Just for the reference, you can always login to your Azure portal and check the blob, there you can find the hierarchical blob.

Hierarchy Folder Structure in Azure Storage Container

Figure 7: Hierarchy Folder Structure in Azure Storage Container

Thanks for reading! I will come back with another article which will explore Azure CDN. Happy uploading!.


Did I miss anything that you think is needed? Could you find this post useful? I hope you liked this article. Please share your valuable suggestions and feedback.

Your Turn. What Do You Think?

A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, ASP.NET Forum instead of commenting here. Please leave me a message in the comments section below with your question and I’ll definitely try to help if I can.


  • 29th May, 2017: Initial version


This article, along with any associated source code and files, is licensed under The MIT License

Written By
Software Developer
Germany Germany
I am Sibeesh Venu, an engineer by profession and writer by passion. I’m neither an expert nor a guru. I have been awarded Microsoft MVP 3 times, C# Corner MVP 5 times, DZone MVB. I always love to learn new technologies, and I strongly believe that the one who stops learning is old.

My Blog: Sibeesh Passion
My Website: Sibeesh Venu

Comments and Discussions

-- There are no messages in this forum --