DEV Community

Cover image for How to provide storage for the public website
Ikuraa Matthew
Ikuraa Matthew

Posted on

How to provide storage for the public website

First of, a Storage account is a container that contains all your storage objects that provides scalability, accessibility, durability and security for your data's

Overview of what is needed

Steps in Providing Storage For The Public Website

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

Storage account

step 2 Select + Create

+ Create

step 3 For resource group select new. Give your resource group a name and select OK

Give your resource group a name

STEP 4 Set the Storage account name to publicwebsite. Make sure the storage account name is unique by adding an identifier

storage account name

STEP 5 Take the defaults for other settings

Take the defaults for other settings

STEP 6 Select Review and then Create

Select Review and then Create

STEP 7 Wait for the storage account to deploy, and then select Go to resource

Wait for the storage account to deploy

This storage requires high availability if there’s a regional outage. Additionally, enable read access to the secondary region, Learn more about storage account redundancy

STEP 1 In the storage account, in the Data management section, select the Redundancy

select the Redundancy

STEP 2 Ensure Read-access Geo-redundant storage is selected

Read-access Geo-redundant storage is selected

STEP 3 Review the primary and secondary location information

Review the primary and secondary location information

Information on the public website should be accessible without requiring customers to login

STEP 1 In the storage account, in the Settings section, select the Configuration blade

Configuration

STEP 2 Ensure the Allow blob anonymous access setting is Enabled.

Enabled

STEP 3 Be sure to Save your changes

Save your changes

The public website has various images and documents. Create a blob storage container for the content. Learn more about storage containers

STEP 1 In your storage account, in the Data storage section, select the Containers blade

Containers

STEP 2 Select + Container

+ Container

STEP 3 Ensure the Name of the container is public

public

STEP 4 Select Create

Create

CREATED

Customers should be able to view the images without being authenticated. Configure anonymous read access for the public container blobs. Learn more about configuring anonymous public access.

STEP 1 Select your public container

public container

STEP 2 On the Overview blade, select Change access level

select Change access level

STEP 3 Ensure the Public access level is Blob (anonymous read access for blobs only)

anonymous read access for blobs only

STEP 4 Select OK

Select OK

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

STEP 1 Ensure you are viewing your container

container

STEP 2 Select Upload.

Uploaad

STEP 3 Browse to files and select a file. Browse to a file of your choice

Browse to a file of your choice

STEP 4 Select Upload

Upload

STEP 5 Close the upload window, Refresh the page and ensure your file was uploaded

file was uploaded

Determine the URL for your uploaded file. Open a browser and test the URL.

STEP 1 Select your uploaded file

uploaded file

STEP 2 On the Overview tab, copy the URL

copy the URL

STEP 3 Paste the URL into a new browser tab

new browser tab

STEP 4 If you have uploaded an image file it will display in the browser. Other file types should be downloaded.

Image

It’s important that the website documents can be restored if they’re deleted. Configure blob soft delete for 21 days. Learn more about soft delete for blobs

STEP 1 Go to the Overview blade of the storage account.

Overview

STEP 2 On the Properties page, locate the Blob service section and enable blob soft delete

Blob service

Ensure the Enable soft delete for blobs is checked, changed the days to 21days,Enable soft delete for containers, Save your changes

Enable soft delet

If something gets deleted, you need to practice using soft delete to restore the files.

STEP 1 Navigate to your container where you uploaded a file

container

STEP 2 Select the file you uploaded and then select Delete

select Delete

Selete delete

STEP 3 Select OK to confirm deleting the file

OK/DELETE

STEP 4 Select your deleted file, and use the ellipses on the far right, to Undelete the file.

Image

Undelete

STEP 5 Refresh the container and confirm the file has been restored

Refresh

It’s important to keep track of the different website product document versions. Learn more about blob versioning.

STEP 1 Go to the Overview blade of the storage account

storage account

STEP 2 In the Properties section, locate the Blob service section

Blob service

STEP 3 Select the Versioning setting

Versioning

STEP 4 Ensure the Enable versioning for blobs checkbox is checked.

Enable versioning

STEP 4 Don’t forget to Save your changes

Save

As you have time experiment with restoring previous blob versions.

STEP 1 Upload another version of your container file. This overwrites your existing file.

Upload another version of your container file

STEP 2 Your previous file version is listed on Show deleted blobs page.

listed on Show deleted blobs page

Top comments (0)