DEV Community

Cover image for Storage for a public website
Precious Uchechukwu Nwafor
Precious Uchechukwu Nwafor

Posted on

Storage for a public website

Think of storage as a digital warehouse.

Just like a physical warehouse stores boxes safely so they can be retrieved later, digital storage keeps files and data safe so they can be accessed whenever needed.

When you upload a photo, a document, a video, or even a database record, that information needs a place to live.

That place is called storage.

Let's get to it!

Phase 1 - Create a storage account to support the public website.

The Action Plan :

1 . In the portal, search for and select Storage accounts.

Searching for 'storage account' in the Azure portalservices

2 . Select + Create.
Accessing the ** + create storage account** configuration blade

3 . For resource group, select new . Give your resource group a name and select OK. Select Review and then Create

Assigning a Resource Group to organize and manage the storage account

4 . Set the Storage account name to publicwebsite. Make sure the storage account name is unique by adding an identifier. Take the defaults for other settings.

Configuring a unique storage name and identifier

5 . Select Create.

Launching the final validation and deployment

6 . Wait for the storage account to deploy, and then select Go to resource.

Navigating to the new storage account dashboard after validation

7 . This storage requires high availability if there’s a regional outage. Additionally, we will enable read access to the secondary region. In the storage account, in the Data management section, select the Redundancy blade. Ensure Read-access Geo-redundant storage is selected. Review the primary and secondary location information.

Selecting RA-GRS to ensure multi-region availability

8 . Information on the public website should be accessible without requiring customers to login. So in the Settings section, select the Configuration blade. Ensuring the Allow blob anonymous access setting is Enabled and Save changes.

Toggling the anonymous access setting 'Enabled and saving changes in the storage account dashboard

Phase 2 - Create a blob storage container with anonymous read access.

The Action Plan :

1 . In your storage account, in the Data storage section, select the Containers blade. Select + Container. Ensure the Name of the container is public. Select Create.

Creating new container to host website assets

2 . Customers should be able to view the images without being authenticated. Configure anonymous read access for the public container blobs. Select your public container. On the Overview blade, select Change access level. Ensure the Public access level is Blob (anonymous read access for blobs only). Select OK.

Updating the container access level

Phase 3 - For testing, upload a file to the public container. The type of file doesn’t matter. A small image or text file is a good choice.

The Action Plan :

1 . Ensure you are viewing your container.
Select Upload. Browse to files and select a file. Browse to a file of your choice. Select Upload. Close the upload window, Refresh the page and ensure your file was uploaded.

Uploading and verifying local assets

2 . Determine the URL for your uploaded file. Open a browser and test the URL. Select your uploaded file. On the Overview tab, copy the URL. Paste the URL into a new browser tab. If you have uploaded an image file it will display in the browser. Other file types should be downloaded.

Testing public access in a new browser

Phase 4 - It’s important that the website documents can be restored if they are deleted. We will proceed to Configure blob soft delete for 21 days.

The Action Plan :

1 . Go to the Overview blade of the storage account. On the Properties page, locate the Blob service section. Select the Blob soft delete setting.

Configuring the Blob soft delete settings

2 . Ensure the Enable soft delete for blobs is checked. Change the Keep deleted blobs for (in days) setting to 21. Notice you can also Enable soft delete for containers. Save your changes.

3 . If something gets deleted, you need to practice using soft delete to restore the files. Navigate to your container where you uploaded a file. Select the file you uploaded and then select Delete.

Soft delete

4 . Select OK to confirm deleting the file.

Delete confirmation

5 . On the container Overview page, toggle the slider Show deleted blobs. This toggle is to the right of the search box. Select your deleted file, and use the ellipses on the far right, to Undelete the file.

Delete recovery

  1. Refresh the container and confirm the file has been restored.

Phase 5 - Configure blob versioning. It’s important to keep track of the different website product document versions.

The Action Plan :

1 . Go to the Overview blade of the storage account. In the Properties section, locate the Blob service section. Select the Versioning setting.

Selecting Versioning

2 . Ensure the Enable versioning for blobs checkbox is checked. Notice your options to keep all versions or delete versions after. Don’t forget to Save your changes.

Enabling versioning

3 . As you have time experiment with restoring previous blob versions. Upload another version of your container file. This overwrites your existing file. Your previous file version is listed on Show deleted blobs page.

Another container file version

MISSION COMPLETE!

Top comments (4)

Collapse
 
realcloudprojects profile image
SKILL.SCH

Welldone!

Collapse
 
precious_nwafor profile image
Precious Uchechukwu Nwafor

Thank you so much, Coach

Collapse
 
otuto_chukwu profile image
Otuto Chukwu

This is very detailed. Well done, Precious, on being granular with the explanations.

Collapse
 
precious_nwafor profile image
Precious Uchechukwu Nwafor

Thank you so much, Otuto.