Create a high-availability storage account with public access, a blob container, soft delete, and blob versioning enabled.
Tags: webdev, beginners, programming, devops
Published: 2024-06-21 05:23:30

To create a storage account with high availability you first have to create a storage account to support the public website. In the Azure portal, search for and select Storage accounts then press create. 
Create a new resource group and give it a name. Give a name for the storage account name. 

![publicsite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wwmdt0pk2fh205cwjcn1.png)

Select Review + Create. Once the storage account is deployed press go to resource. In the storage account, navigate to the Data management section, and click on Redundancy. Select Read-access Geo-redundant storage. Review the primary and secondary location information. 

![Geo redundant storage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3hm6c90yb6xzzf9f06lx.png)

To ensure that information on the public website is accessible without requiring customers to login select Configuration in the settings section in the storage account. Enable the Allow blob anonymous access setting and save changes.

![allow blob anon access](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2sblabcezrjh4hrflp9n.png)

To create a blob storage container with anonymous read access in your storage account, find the Data storage section, and select Containers. Click new container and name your container and press create.

![blob storage container](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/st3775e6rqdmwu01d956.png)

To ensure that customers are able to view images without being authenticated select your container, and in the overview section, select change access level. Public access level should be Blob and press OK. For testing, upload a file to the public container. Any file type works. Click "Upload." Select a file of your choice and upload. Refresh the page, and confirm that your file was uploaded successfully. Open a browser and test the URL given.

![public access level](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3iakck5dppexhhunvyah.png)

To restore documents that have been delete configure blob soft delete. To do this, in the overview section of the storage account. Navigate to the properties page, and find the Blob service section. Select the Blob soft delete setting. Check off the Enable soft delete for blobs.  Change the Keep deleted blobs for and save. 

![configure blob soft delete](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wdt9wra1ctv7sgfux4rc.png)

To use soft delete to restore files. Go to your container where you uploaded the file. Select and delete that file. On the container Overview page, toggle the slider to Show deleted blobs. Select the deleted file, and use the ellipses on the far right, to Undelete. Refresh the container and ensure the file has properly been restored. 

![show deleted blobs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzsdactyea7lowq68zlt.png)

It's essential to maintain a record of the different versions of your website's product documents. Here's how to enable blob versioning: Go to the Overview section of the storage account. and find the Properties section, and then Blob service section. Select the Versioning setting. Check the "Enable versioning for blobs" checkbox. Save the changes.

![enable versioning for blobs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3qamhzh3bgu9vcqvr8ji.png)

To restore previous blob versions, upload a new version of the container file, which will overwrite the existing file. The previous file version will appear on the Show deleted blobs page.