liveBook · Manning

Static site

As explained in Microsoft Azure in Action

A static website is a website whose pages are delivered as precomposed files rather than generated dynamically for each request.

A static site serves HTML, CSS, and JavaScript files directly to a browser instead of generating pages for each request with a runtime such as Node.js, ASP.NET, or Java. It suits a simple website that changes infrequently and needs no dynamic content. Azure Storage can host one without a traditional web server to manage. section 9.2

A small business website

Banning Books needs a low-maintenance site for customers, not dynamically generated pages. Its ready-made website files—or your own—can be uploaded to an Azure Storage account. The catch is important: Azure Storage static website hosting serves static content only. section 9.2 section 9.2.3

To publish the files in Azure Storage:

  • Put the site’s HTML, CSS, and JavaScript files in the storage account’s $web container. Enabling static website hosting creates $web if it does not already exist, but the files still need to go there. AzCopy can upload them; authenticate its commands with a Shared Access Signature (SAS) token or Entra ID. section 9.2.1 section 9.2.3
  • Enable the static website feature and specify an index document and a 404 error document, such as index.html and error.html. Check that the feature is enabled in the Azure portal, then test the website endpoint. section 9.2.3
C:/> az storage blob service-properties update 
--account-name banningstorage --static-website 
--404-document error.html --index-document index.html

This Azure CLI command enables static website hosting on a storage account and names its home and error pages. Replace the account name and filenames to match your site. section 9.2.3

The default Azure-provided URL may be awkward to share. For a custom domain, acquire a domain, add a CNAME record for a subdomain such as www, connect that domain in the storage account’s Custom Domain settings, and test it. Do not treat a browser warning as a production security plan: secure site traffic with an SSL certificate or a service such as Azure CDN. section 9.2.4

How Microsoft Azure in Action covers it

How deep it goes
Works through file placement, publishing, index and error documents, verification, and custom domains, while deferring deployment automation.
Examples
Uses a small business website, index.html and error.html, Azure CLI configuration, and a custom subdomain as concrete examples.
What it assumes
Assumes website files are available and introduces the storage-specific steps needed to host them.
What you can do after
Operate/configure it by uploading files to $web, enabling Azure Storage static website hosting, testing its endpoint, and optionally connecting a custom domain.
How it connects
Connects static sites to Azure Blob Storage, AzCopy, SAS tokens, CNAME records, and HTTPS.

Also explained in

Compare how 2 books explain static site →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microsoft Azure in Action. The section links point to the parts of the book it draws on.