Host a static website in Azure Storage

You can serve static content (HTML, CSS, JavaScript, and image files) directly from a container in an Azure Storage GPv2 account. To learn more, see Static website hosting in Azure Storage.

This article shows you how to enable static website hosting by using the Azure portal, the Azure CLI, or PowerShell.

For a step-by-step tutorial, see Tutorial: Host a static website on Blob Storage.

After you enable static website hosting, you can view the pages of your site from a browser by using the public URL of the website.

Find the website URL by using the Azure portal

In the pane that appears beside the account overview page of your storage account, select Static Website. The URL of your site appears in the Primary endpoint field.

Azure Storage static websites metrics metric

Enable metrics on static website pages

Once you've enabled metrics, traffic statistics on files in the $web container are reported in the metrics dashboard.

  1. Click on Settings > Monitoring > Metrics.

    Metrics data are generated by hooking into different metrics APIs. The portal only displays API members used within a given time frame in order to only focus on members that return data. In order to ensure you're able to select the necessary API member, the first step is to expand the time frame.

  2. Click on the time frame button and select Last 24 hours and then click Apply.

    Azure Storage static websites metrics time range

  3. Select Blob from the Namespace drop down.

    Azure Storage static websites metrics namespace

  4. Then select the Egress metric.

    Azure Storage static websites metrics metric

  5. Select Sum from the Aggregation selector.

    Azure Storage static websites metrics aggregation

  6. Click the Add filter button and choose API name from the Property selector.

    Azure Storage static websites metrics API name

  7. Check the box next to GetWebContent in the Values selector to populate the metrics report.

    Azure Storage static websites metrics GetWebContent

Next steps