DEV Community

Cover image for Provide Storage Account For the Public Website
nnamdi nmarah
nnamdi nmarah

Posted on

Provide Storage Account For the Public Website

What does “public website” mean in Azure?

In Azure, a public website is one that is accessible over the internet, does not require authentication, and can be viewed by anyone who has the URL.

Create a storage account with high availability

Create a storage account to support the public website.

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

select Storage accounts

  • Select + Create.

plus create

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

select new

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

storage account name

  • Take the defaults for other settings.

defaults for other settings

  • Select Review and then Create

Review plus Create

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

select Go to resource

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.

  • In the storage account, in the Data management section, select the Redundancy blade.

select the Redundancy blade

  • Ensure Read-access Geo-redundant storage is selected.

select Read-access Geo-redundant storage

  • Review the primary and secondary location information.

primary and secondary location

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

  • In the storage account, in the Settings section, select the Configuration blade.

select the Configuration blade

  • Ensure the Allow blob anonymous access setting is Enabled.

Enable Allow blob anonymous access

  • Be sure to Save your changes.

Save your changes

Create a blob storage container with anonymous read access

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

  • In your storage account, in the Data storage section, select the Containers blade.

select the Containers blade

  • Select + Container.

plus container

  • Ensure the Name of the container is public.

Name the container public

  • Select Create.

Select Create

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.

  • Select your public container.

Select your public container

  • On the Overview blade, select Change access level.

select Change access level

  • Ensure the Public access level is Blob (anonymous read access for blobs only).

Ensure the Public access level is Blob

  • Select OK.

Select OK

Practice uploading files and testing access.

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.

  • Ensure you are viewing your container.

select the container

  • Select Upload.

Select Upload

  • Browse to files and select a file. Browse to a file of your choice.

select a file

  • Select Upload.

Select Upload

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

Refresh the page

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

  • Select your uploaded file.

Select your uploaded file

  • On the Overview tab, copy the URL.

copy the url

  • Paste the URL into a new browser tab.

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.

uploaded file

Configure soft delete

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.

  • Go to the Overview blade of the storage account.

Overview blade of the storage account

  • On the Properties page, locate the Blob service section.

Properties page

  • Select the Blob soft delete setting.

Select the Blob soft delete setting

  • Ensure the Enable soft delete for blobs is checked.

Enable soft delete for blobs

  • Change the Keep deleted blobs for (in days) setting to 21.

Change the Keep deleted blobs to 21

  • Notice you can also Enable soft delete for containers.

Enable soft delete for containers

-Don’t forget to Save your changes.

Save your changes

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

  • Navigate to your container where you uploaded a file.

uploaded file

  • Select the file you uploaded and then select Delete.

select the file

  • Select OK to confirm deleting the file.

Select OK

-On the container Overview page, toggle the slider Show deleted blobs. This toggle is to the right of the search box.

toggle the slider Show deleted blobs

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

Undelete the file

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

Refresh the container

Configure blob versioning

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

  • Go to the Overview blade of the storage account.

Overview blade of the storage account

-In the Properties section, locate the Blob service section.

locate the Blob service section

  • Select the Versioning setting.

Select the Versioning setting

-Ensure the Enable versioning for blobs checkbox is checked.

Enable versioning for blobs checkbox

-Notice your options to keep all versions or delete versions after.

keep all versions

  • Don’t forget to Save your changes.

Save your changes

Top comments (1)

Collapse
 
realcloudprojects profile image
SKILL.SCH

100%