Technical Thursday – Store “monster” files in Azure for anonymous access

In this week I would like to show you a cool feature of Azure Storage Account. A really useful function which makes our life easier if we want to store monster size files such as for blog, download. Additionally this is almost free… 🙂

Often you are facing that situation when you would like to share some large size files (zip, pdf, images) with someone. Of course you can share it via OneDrive, DropBox, Pendrive or some kind of stuff. There are many cloud solutions which support this on very secure way but you can see their capability is quite limited if you would like to use these files from your website (such as WordPress, Drupal, Joomla).

Therefore here you can see the almost free, secure and flexible solution. Now I show you how can integrate this with your WordPress site.

Requirements

 

Configuration

Here you can find the Azure and WordPress related configuration steps

Azure
    1. Firstly you should (create a subscription in Azure and) login to your subscription (https://portal.azure.com)
    2. Then you have to create a Storage Account inside your subscription
      1. Click the “+ New” button on the top left corner on the screen
      2. Then search for “storage account” expression
      3. Choose the “Storage account – blob, file, table, queue” from the list then click to “Create” button on the blade.
      4. Type a name which is unique on Azure level
      5. Choose the followings to keep the cost low.
        1. Deployment model: Resource manager
        2. Performance: Standard
        3. Replication: Locally-redundant storage (LRS)
        4. Secure transfer required: Enabled
        5. Subscription: chhose your PAY-AS-YOU-GO subscription
        6. Resource group: Create new (type a name for here like: myresourcegroup)
        7. Location: choose a location
        8. Virtual networks: Disabled
      6. Then click to “Create” button.
    3. When you have created this account got to there and you can see the overview of it
    4. In the storage account blade find the “Containers” options and click on it
    5. Then click upper the “+ Container” button
    6. Type the name for your public file container (this is same like  a directory) and under the Public access level choose the “Container (anonymous access for containers and blobs)”
    7. To create this container click to “OK” button
    8. Now you step into this container and choose the “Upload” button to upload your large files
    9. Then you upload the file via the panel which appears (browse the file then click “Upload”)
    10. Great! We have a file in this container.
    11. Click the file then a blade appears on the right side where you can find the url of the file
    12. Copy this url and from now we can share this with anybody.
    13. Let’s test it…
      1. Paste the url to your browser
      2. and hit enter and you or your friend can easily save the file
    14. We are ready for the WordPress integration…

 

WordPress

We know the url of file and we can easily open or download it via our website.

  1. Login to our WordPress site
  2. “Add new” post
  3. Then write your post and put  a link with the file url inside it
  4. Finally “Publish” the post.
  5. Awesome…Anyone who visit your page can download your extra large file and this file does not “eat” your expensive WordPress disk space.

Bonus

There is a bonus at storage account side. I you would not like to use the Azure specified url you can use your own domain related url. The only thing which have to be configure the “Custom domain” inside storage account.

Briefly:

  1. Click on “Custom domain” options at storage account
  2. Then follow the instructions on the page
  3. Then you can access to file via your custom url like: https://storage.yourdomain.com/mypublicfiles/exampleBigFile1.pdf

 

 

Is it really easy, isn’t it…and almost free. 😉