DEV Community

Cover image for Provide Storage for the Public Website
Oluwatosin A.
Oluwatosin A.

Posted on

Provide Storage for the Public Website

Introduction

The public website is a key asset for any company. It is where the company displays product images, promotional videos, marketing copy, customer success stories, and many more.

In Azure, these types of unstructured non-relational data are referred to as blob (binary large objects).

Company growth will probably translate to more site visits. Therefore, it is essential that the website content remains highly available, loads quickly, and supports features like version control and easy recovery.

In this guided exercise from Microsoft, we will create and configure an Azure Storage account specifically for hosting this public content.

We will make it high available, and the contents open for public read access. We will set up a blob container, practice uploading and testing files, enable soft delete to recover accidentally deleted items, and activate versioning to track changes to documents.


Consider the architectural diagram below:

architectural diagram


A. Create a Storage Account with High Availability


Step 1: Create a storage account for the public website


1.1 Go to portal.azure.com

1.2 In the search bar, type storage accounts. Select Storage Accounts(Classic) from the drop down suggestions

storage accounts search

1.3 Click + Create

create storage account

1.4 Click Create new to create a new resource group. Give it a name and click OK

1.5 In the Storage account name field, type a globally unique account name

1.6 Maintain default selections for other settings

1.7 Scroll to the bottom of the page, click Review + create. On the next page, click Create

review and create

1.8 Wait for the deployment to be completed. Click Go to resource.

go to resource


Step 2: Configure the storage account for high availability


2.1 In the storage account, navigate to the left pane. Click Data Management

2.2 Click Redundancy

2.3 Make sure Read-access geo-redundant storage (RA-GRS) is selected

2.4 Confirm two(2) locations are shown, indicating RA-GRS is successfully deployed.

redundancy


Step 3: Make information stored in the storage account open for public access


3.1. Go to left pane of the storage account. Click Settings

3.2. Click Configuration

3.3. Enable Allow Blob anonymous access

3.4. Save Changes

Allow Blob anonymous access


B. Create a Blob Storage Container with Anonymous Read Access


Step 4: Create a container to store website blob such as documents and pictures


4.1 Still on the storage account, on the left pane, click Data storage

4.2 Click Containers

4.3 Click + Add container

4.4 Give the container a name. Type public in the Name field.

4.5 Click Create

Data storage container public


Step 5: Set anonymous read access so customers can view information stored in the container without authenticating


5.1 Select the public container you just created

public container

5.2 Go to Overview. Click Change access level

public container overview

5.3 Set Anonymous access level to Blob (anonymous read access for blobs only). Click Ok

set Anonymous access level


C. Practice uploading files and testing access


Step 6: Upload a file to the public container for testing purpose


6.1 In the public container, click Upload

6.2 Click *Browse for files in the new window. Upload any file type, preferably a small sized text or image

Browse for files

6.3 Click Upload

upload test file

6.4 Ensure test file is successfully uploaded (you may have to refresh the page)

successfully uploaded test file


Step 7: Get file URL and test in browser


7.1 Click uploaded test file

7.2 A file window opens up to the right. In the Overview tab, copy shown URL to clipboard

test file

7.3 Open a new browser tab. Paste copied URL in the address bar and hit enter. If test file is an image, it will be dispayed in the browser. Other file types are downloaded.

file in browser


D. Configure Soft Delete


Step 8: Set a 21-day soft delete duration. Files deleted within this period can be restored (similar to a desktop recycle bin)


8.1 Go to the storage account. Click Overview

8.2 In the properties tab, find Blob soft delete. Notice the default setting is Enabled (7 days). Click to change.

Blob soft delete

8.3 Ensure Enable soft delete for blobs is checked.

8.4 In the Keep deleted blobs for (in days) field, change the value to 21.

8.5 Save Changes

save changes


Step 9: Practice how to restore deleted files using soft delete


9.1 Go to the public container - Storage accounts > Data storage > Containers > public

9.2 Select uploaded file. Click Delete

delete test file

9.3 Notice the file is deleted. Locate the Only show active blobs drop down beside the search box. Toggle and select Show active and deleted blobs

Only show active blobs

9.4 Select file. Locate the context menu far right. Click and select Undelete

Undelete

9.5 Confirm deleted file is restored.

Confirm deleted file is restored


E. Configure Versioning


Step 10: Set Blob versioning to retain versions of website documents as you update them


10.1 Go to storage account

10.2 Click Overview

10.3 Under Blob service, locate Versioning. Click Disabled

Blob service versioning

10.4 Check Enable versioning for blobs

10.5 Save Changes

Enable versioning for blobs


Step 11: Experiment with restoring previous version of your blob file


11.1 Go to the public container. In Overview, upload another version of the test file you uploaded earlier. Notice the alert the following files already exist

the following files already exist

11.2 Check Overwrite if file already exist. Click Upload. Once successfully uploaded, the previous version is deleted.

Overwrite if file already exist

11.3 To view deleted version, click on the context menu button far right

view deleted version

11.4 Click View versions

View versions

11.5 Beside the Filter versions field, toggle Show deleted versions

Filter versions


Wrapping Up


Now that we have successfully provisioned and configured a highly available Azure Storage solution for the company’s public website, we are rest assured the content on the public-facing website is resilient, recoverable, and globally accessible with low latency.

Top comments (2)

Collapse
 
realcloudprojects profile image
SKILL.SCH

Neat work. Welldone!

Collapse
 
biola_lawaljr_d5dc2882c89 profile image
Biola Lawaljr

Good job.