DEV Community

Cover image for How I Set Up Azure Storage for My First Public Website
Emmanuel Banjo
Emmanuel Banjo

Posted on

How I Set Up Azure Storage for My First Public Website

Introduction

I needed a place to store images and files for a website project. Azure Blob Storage turned out to be perfect. it's basically a file system in the cloud that anyone can access via a URL.
This guide shows you exactly how to set it up, make files publicly accessible, and add some safety features so you don't lose your work if something gets deleted.

Create the Storage Account

  • Search for Storage accounts in Azure Portal search storage
  • Click + Create create
  • Create a new resource group (name it something like website-storage) new rg
  • Name your storage account publicwebsite plus some numbers (like publicwebsite2024)
  • Click Review then Create create sg
  • Wait for deployment, then click Go to resource deployment complete

Set Up High Availability

This makes sure your files are backed up in multiple locations.

  • Go to Data management → Redundancy redundancy
  • Select Read-access geo-redundant storage read-access You'll see two locations: primary and secondary Now if one region goes down, your files are still available. Cool, right?

Allow Public Access

By default, storage is locked down. We need to open it up for public website files.

  • Go to Settings → Configuration settings
  • Turn on Allow Blob anonymous access
  • Click Save blob

Create Your Container

Containers are like folders that hold your files.

  • Go to Data storage → Containers
  • Click + Container container
  • Name it public
  • Click Create public

Make Files Publicly Accessible

  • Click on your public container
  • Click Change access level change access
  • Select Blob (anonymous read access for blobs only) error
  • Click OK correct

Now anyone with the URL can view your files!

Upload and Test a File

  • In your container, click Upload
  • Choose any image or text file
  • Click Upload upload
  • After upload, click on your file image
  • Copy the URL from the Overview tab url
  • Paste it in a new browser tab Image If you see your file, it worked! 🎉

Set Up Soft Delete (The Undo Button)

This is like having a recycle bin. If you accidentally delete something, you can get it back for 21 days.

  • Go back to your storage account overview
  • Find Properties → Blob service section
  • Click Blob soft delete
  • Check Enable soft delete for blobs soft delete
  • Set it to 21 days
  • Click Save save

Testing Soft Delete

  • Go to your container
  • Select a file and click Delete delete
  • Toggle Show deleted blobs (top right)
  • Select the deleted file undelete
  • Click the three dots and choose Undelete image back

Your file is back!

Enable Versioning

This keeps a history of your file changes, like version control for your files.

  • Back in storage account Properties
  • Find Blob service → Versioning versioning
  • Check Enable versioning for blobs
  • Click Save save

Now when you upload a new version of a file, the old one is saved automatically.

You just set up cloud storage that's accessible from anywhere on the internet. This is the same technology that powers file hosting for major websites and apps.

One Important Warning
Since you made this publicly accessible, never upload sensitive information. Anything you put here can be accessed by anyone with the URL. No passwords, no private data, no confidential documents.

Got stuck anywhere? Drop a comment and I'll help you out. We're all figuring this stuff out together! Please like and share!!!

Top comments (1)

Collapse
 
forsyth_famous_ profile image
forsyth famous

Thank you so much for the clear explanation 👏🏽. Excellent work!