DEV Community

Cover image for Provide Storage for the Public Website
Biola Lawaljr
Biola Lawaljr

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:

Architecture 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 account(classic)

1.3 Click + Create
Create

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

Create a storage account(classic)

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

Deployment

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

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

Create

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

Change Access Level

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

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

click Upload

6.3 Click Upload

successfully uploaded

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

Overview

Step 7: Get file URL and test in browse

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

Paste copied URL

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.

Enabled (7 days)

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.

Save Changes

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

Delete

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

active and deleted blobs

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 bl

Undelete

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

 restored

9.5 Confirm deleted file is restored.

Disabled

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

Enable versioning for blobs

Blob service versioning

10.4 Check Enable versioning for blobs

10.5 Save Changes

Overview

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

Overwrite

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

context menu

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 (1)

Collapse
 
realcloudprojects profile image
SKILL.SCH

Nice