Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

Hosting a Static Website with Azure Blob Storage

Azure Storage Blobs are a great tool for storing all kinds of data, but they can also be used to serve that data anywhere in the world. As such, Blobs can be used to host and serve a simple, static website. In this lab, you will have the opportunity to work with Azure Storage Blobs by using them to host a static website. You will create and configure the necessary storage account, and you will upload static files to Blob storage. When you finish, you will be able to view the static website in your browser.

Azure icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 45m
Published
Clock icon Feb 14, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create a storage account to host the static website.

    1. Click + Add to create a new resource.
    2. Search for and select Storage Account.
    3. For Resource Group, select the existing resource group if it is not already selected.
    4. Enter a Storage account name that begins with staticsite. You may need to add some characters at the end of the name to make it unique.
    5. Click Review + Create, then Create.
  2. Challenge

    Configure the storage account for static site hosting.

    1. Wait for your storage account to finish being created. When viewing the resource group, you can click Refresh. When your storage account appears in the list, it has been created.
    2. Click on your storage account, then click Static Website on the left side of the storage account pane.
    3. Click Enabled to enable static website hosting for the storage account.
    4. For Index document name, enter index.html.
    5. Click Save.
  3. Challenge

    Upload the static site files.

    1. Log in to Azure Cloud Shell at https://shell.azure.com.
    2. Select Bash, then advanced settings. Select use existing for all three fields, and enter cloudshell for the container.
    3. Get the key for the storage account. Note that you can find the resource group name in the Azure portal. The storage account name is the name of the storage account you created earlier.
    export AZURE_STORAGE_ACCOUNT="&ltstorage account name>"
    export RESOURCE_GROUP="&ltresource group name>"
    az storage account keys list 
      --account-name $AZURE_STORAGE_ACCOUNT 
      --resource-group $RESOURCE_GROUP 
      --output table
    
    1. Set an environment variable containing the storage account key.
    export AZURE_STORAGE_KEY="&ltkey>"
    
    1. Clone the lab resources repository from GitHub and switch to the static site directory.
    git clone https://github.com/linuxacademy/content-azurestoragedd-lab-resources.git
    cd content-azurestoragedd-lab-resources/satt-static-site/
    
    1. Upload the static site files as blobs within the $web container.
    az storage blob upload-batch -d "\$web" -s .
    
    1. In Azure portal, navigate back to the static site storage account and select Static Website again. This page contains a URL under Primary Endpoint. Copy this URL and access it in a new tab.

    You should see the website for Store All The Things!

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans