DEV Community

Cover image for Creating a Storage Account for a Public Website on Azure
Blessing Oseyenum
Blessing Oseyenum

Posted on

Creating a Storage Account for a Public Website on Azure

In this post, I'll be showing you how to create and configure a storage account for a company's website. The storage account is for product images and videos, documents and so on. Requirements for this are:

  • Storage account with high availability.

  • Storage account should have anonymous public access.

  • Blob storage container for the website images, videos and other documents.

  • Soft delete so files can be easily restored.

  • Blob versioning to keep track of the different website product document versions.
    So let's get to it

In Azure portal, search for and select Storage accounts.

Image description
Select + Create.

Image description
Give your resource group a name.

Image description
Input storage account name and select Region.

Image description
To ensure high availability, for Redundancy select Read access Geo Redundant Storage.

Image description
Select Review then Create.

Wait for deployment to complete, then Go to Resource.

Image description
To ensure information on public website is accessible go to the Settings section of the storage account, select the Configuration blade.

Image description
Ensure the Allow blob anonymous access setting is Enabled.

Image description
Save changes.

To create a blob storage container for the content of the website, go to the Data storage section of storage account, select the Containers blade.

Image description
Select + Container.

Image description
Give container a name and select Create.

Image description

Customers should be able to view the images without being authenticated. Configure anonymous read access for the public container blobs.
Select your container.

Image description
On the Overview blade, select Change access level. Ensure the Public access level is set to Blob (anonymous read access for blobs only). Select OK.

Image description

Test by uploading a file to the public container. It could be an image or a text file. Select Upload.

Image description
Browse for files and select a file. Browse to a file of your choice.

Image description

Image description
Select Upload.

Image description

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

Image description
Select your uploaded file.

Image description

On the Overview tab, copy the URL.

Image description

Paste the URL into a new browser tab.
Image description

Uploaded image file will display in the browser.
Image description

Now, it's time to configure soft delete. This is to ensure that documents can be restored if they’re deleted.
Go to the Overview blade of the storage account. In the Properties section, locate the Blob service section.

Image description
Select the Blob soft delete setting.

Image description
Ensure the Enable soft delete for blobs is checked and change the Keep deleted blobs for (in days) setting to 21.

Image description
Save changes.

Next step is to configure versioning. This is to keep track of the different website product document versions.
Go to the Overview blade of the storage account. In the Properties section, locate the Blob service section. Select the Versioning setting.
Image description
Ensure the Enable versioning for blobs checkbox is checked.

Image description
Save changes.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.