Hosting a static website on Azure Blob Storage offers a scalable and budget-friendly solution. Enabling public access, soft delete, and blob versioning ensures your site is accessible to users, protected against accidental deletions, and maintains a history of file changes.
Architecture diagram
This guide will show you step by step how to:
-Create an Azure Blob Storage account with high availability that will continue to work and keep data accessible, even if some hardware or entire regions fail.
-Allow anonymous public access so that anyone can view your files without needing to log in.
-Create a blob storage container to store your website files and make them available online.
-Enable soft delete, which lets you recover files if they are accidentally deleted.
-Enable blob versioning, so you can go back to earlier versions of a file if needed.
These are the steps to follow:
Create a storage account with high availability.
Step 1. Log in to the Azure Portal.
Step 2. In the portal, search for and select Storage accounts.
Step 3. Select + Create.
Step 4. For resource group select new. Give your resource group a name and select OK
Step 5. Set the Storage account name to publicwebsite.
Step 6. Select Review and then Create.
Step 7. Create and Wait for the storage account to deploy.
Step 8. Go to storage account, in the Data management section, select the Redundancy blade.
Step 9. Ensure Read-access Geo-redundant storage is selected.
Step 10. Review the primary and secondary location information.
Step 11. Go to storage account, in the Settings section, select the Configuration blade.
Step 12. Ensure the Allow blob anonymous access setting is Enabled and make sure to save the changes.
Create a blob storage container with anonymous read access
Step 1. Go to storage account, in the Data storage section, select the Containers blade.
Step 2. Select + add Container.
Step 3. Ensure the Name of the container is public and select create.
Step 4. Select your public container.
Step 5. On the Overview blade, select Change access level.
Step 6. Ensure the Public access level is Blob (anonymous read access for blobs only).
Step 7. Select OK.
Practice uploading files and testing access.
Step 1. For testing, upload a file to the public container.
A. Ensure you are viewing your container.
B. Select Upload.
C. Browse to files.
D. Select file and upload.
E. Close the upload window, Refresh the page and ensure your file was uploaded.
Step 2. Determine the URL for your uploaded file. Open a browser and test the URL.
A. Select your uploaded file.
B. On the Overview tab, copy the URL.
C. Paste the URL into a new browser tab.
D. If you have uploaded an image file it will display in the browser.
Enabling a blob soft delete with a 21-day retention to allow file recovery.
Step 1. Go to the Overview blade of the storage account.
Step 2. On the Properties page, locate the Blob service section.
Step 3. Select the Blob soft delete setting.
Step 4. Ensure the Enable soft delete for blobs is checked.
Step 5. Change the Keep deleted blobs for (in days setting is 21).
Step 6. Notice you can also Enable soft delete for containers.
Step 7. Select save.
Practice using soft delete to restore deleted files.
How to delete file from the container.
Step 1. Navigate to your container where you uploaded a file.
Step 2. Select the file you uploaded and then select Delete.
Step 3. Select delete to confirm deleting the file.
You can see the file is deleted.
How to restore deleted files.
Step 1. On the container Overview page, go to Show only active blobs on the right side of your screen, click the drop down button and the select show active and deleted blobs.
Step 2. Select your deleted file.
Step 3. Use the ellipses on the far right of the selected deleted file, click Undelete to delete the file.
Step 4. Refresh the container and confirm the file has been restored.
Enable blob versioning.
Step 1. Go to the Overview blade of the storage account.
Step 2. In the Properties section, locate the Blob service section.
Step 3. Select the Versioning setting.
Step 4. Ensure the Enable versioning for blobs checkbox is checked.
Step 5. Notice your options to keep all versions or delete versions after, and save.
Lets try restoring Previous Versions of Blobs in Azure Storage.
Step 1. Upload another version of your container file with the same name but different content.
Step 2. Notice that your newly uploaded file overwrites your already existing file.
Conclusion.
Configuring a highly available Azure Storage account with public access, soft delete, and blob versioning creates a secure and dependable platform for hosting static websites. Public access makes your content easily accessible to users, while soft delete and versioning protect against unintended changes or deletions. By implementing these features, you ensure fast, global content delivery and robust data protection, keeping your website consistently available, resilient, and easily recoverable.