Host Static Website Azure

How to Host a Static Website on Azure Blob Storage

Azure Storage, offered by Microsoft Azure, is a powerful cloud-based solution for storing a wide variety of data types. Designed for flexibility and scalability, it provides businesses with a secure and budget-friendly way to handle their storage needs.

If you’re considering using Azure Blob Storage to host a static website, follow these steps to get started:

Sign Up for an Azure Account

If you’re new to Azure, head to portal.azure.com to create your account.

  1. Prepare Your Website Files
    • Gather all your static website assets, including HTML, CSS, JavaScript, images, and other necessary files, and organize them in a folder on your computer.
  2. Create a Storage Account in Azure
    • A storage account is essential for hosting your website on Azure. Here’s how to set it up:
    • Access the Azure Portal: Log in to the Azure Portal.
    • Create a Resource: Click the “Create a resource” button at the top.
    • Search for Storage Account: Type “Storage Account” in the search bar and select the relevant option.
Host Static Website Azure

Create Your Storage Account

Click “Create” and follow the prompts to configure your account.

Host Static Website Azure

Configure Your Storage Account

Choose Your Subscription: Choose your subscription.
Resource Group: Select an existing group or create a new one. In this Lab, we’ll create a new one. click on Create new
Storage Account Name: Enter a unique name for your storage account.
Region: Choose a region close to your users, we’ll select (US)East US for this lab
Performance: For performance, select Standard.
Replication: Choose the replication option that suits your needs (e.g., LRS, GRS). Here we choose LRS.
Click “Review + Create” and then “Create” after validation is passed.

Host Static Website Azure

Review and Create Your Storage Account

As soon as the deployment is complete, click on Go to resources.

Explore The Overview page

Below is the overview page of the storage account you have just created.

Host Static Website Azure
Host Static Website Azure

Set up your Static Website’s primary endpoint

Our aim here will be to set up the primary endpoints for our static website. On the left panel, scroll to Data Management. From the drop-down, click on Static website.

Host Static Website Azure
Host Static Website Azure

Now, you’re on the Static website overview page. Click on the Enable button to enable the Static website on the blob service. The blob service on the Azure portal allows you to host static content. In the Index document name field type in Index.html. Type in 404.html in the Error document path field.

Click on the Save icon at the top of the page to save all configurations After that, the Primary endpoint URL will be generated as shown in the diagram below.

Create A Container To Store Your Static Website File

After the primary endpoint URL is generated, it’s time now to create the container where all our website files will be uploaded. To create a container, click on Data storage, and from the dropdown select Containers. Click on $web to upload your website files.

Go ahead now with uploading your website files. Drag and drop the selected website files to the storage account’s container. Ensure that your main HTML file is named according to the index document name you set earlier. Click on the Upload button highlighted

Static Website on Azure Blob Storage

Copy the URL into your Chrome or Microsoft Edge browser to see the static web content.

Conclusions

Azure Storage offers a very efficient and cost-effective solution for hosting static websites. By adhering to these straightforward steps, you will easily be able to set up and launch your website on Azure, taking full advantage of its scalability and user-friendly features.

Whether you’re building a personal blog, showcasing a portfolio, or creating a small business page, Azure Storage streamlines the hosting process, letting you focus more on creating great content and engaging with your audience.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *