Not every website needs a server. If your site is pure HTML, CSS and JavaScript — a landing page, documentation, a portfolio, or a frontend built with React or Vue — you can host a static website on Azure Storage for pennies a month, with no virtual machine to patch and nothing to maintain. This guide shows the complete setup with the Azure CLI.
How Static Website Hosting on Azure Storage Works – How to Host a Static Website
A storage account can expose a special container named $web over HTTP and HTTPS. You upload your files, designate an index document (usually index.html) and an error document (usually 404.html), and Azure serves the site from a dedicated web endpoint such as https://mysite.z13.web.core.windows.net/. There is no server-side code execution — for that you would use Azure App Service — but for static content the simplicity is unbeatable.
Prerequisites – How to Host a Static Website
- An Azure subscription and Azure CLI signed in
- A folder with your static site files, including
index.html - A general-purpose v2 storage account (created below)
Step 1: Create the Storage Account
az group create --name rg-static-site --location eastus
az storage account create \
--name kblinuxstaticsite \
--resource-group rg-static-site \
--location eastus \
--sku Standard_LRS \
--kind StorageV2
Step 2: Enable the Static Website Feature
az storage blob service-properties update \
--account-name kblinuxstaticsite \
--static-website \
--index-document index.html \
--404-document 404.html
This command creates the $web container automatically and configures which files to serve as the homepage and the not-found page.

Step 3: Upload Your Site Files
Upload the whole folder in one batch operation:
az storage blob upload-batch \
--account-name kblinuxstaticsite \
--source ./my-site \
--destination '$web' \
--auth-mode login
Content types are inferred from file extensions, so .html, .css, .js and image files are served with the correct MIME types. If a stylesheet downloads instead of rendering, re-upload it with an explicit --content-type "text/css".
Step 4: Find Your Website URL and Test It
az storage account show \
--name kblinuxstaticsite \
--resource-group rg-static-site \
--query "primaryEndpoints.web" \
--output tsv
Open the returned URL in a browser — your static website on Azure Storage is live. Updates are just another upload-batch run; add --overwrite in newer CLI versions if files already exist and are not being replaced.
A Note on HTTPS and the Default Endpoint
The storage web endpoint serves your site over both HTTP and HTTPS with a Microsoft-managed certificate for the web.core.windows.net hostname, so a brand-new site is encrypted from the first upload with nothing to configure. The limitation appears only when you map your own domain directly to storage: that path historically required extra steps for HTTPS, which is why the Front Door or CDN route is recommended for production. Either way, enforce HTTPS in your application links, update any hard-coded http:// asset references before launch, and test the site from a private browser window — first visits reveal mixed-content warnings that a warm cache hides from the developer who built the site.
Step 5 (Optional): Custom Domain and CDN
The default endpoint supports a custom domain through a CNAME record, but HTTPS with your own certificate requires putting Azure Front Door or Azure CDN in front of the storage endpoint. For production sites this is worth it: you get a global cache, free managed certificates and one clean hostname. The Microsoft Learn guide to static website hosting in Azure Storage walks through the custom domain and CDN configuration.
Going Further: SPAs, Redirects and Real-World Costs
Single-page applications built with React Router, Vue Router or Angular need one extra trick: client-side routes like /products/42 do not exist as files, so a direct visit returns the 404 document. The common fix is to set the error document to index.html as well, letting the JavaScript router take over after the shell loads. Costs surprise people in the best way: storage for a typical site is a few hundred megabytes, and you pay a small per-10,000-requests fee plus bandwidth. A low-traffic business site commonly costs well under one US dollar per month; a popular site still lands far below the price of the smallest virtual machine, and you never patch an operating system. For repeatable deployments, wrap the upload-batch command in a CI pipeline — GitHub Actions and Azure DevOps both run the Azure CLI, so every merge to your main branch can publish the new build automatically and purge the CDN cache in the same job.
Troubleshooting
- 404 on the homepage: the index document name is case-sensitive on Linux-built sites —
Index.htmlis notindex.html. - Site loads but assets fail: use relative paths (
./style.css) rather than absolute server paths, especially if you later mount the site under a CDN path. - Changes do not appear: browsers cache aggressively. Hard-refresh, and if you added a CDN, purge its cache after each deploy.
- AuthenticationFailed during upload: with
--auth-mode loginyour account needs the Storage Blob Data Contributor role on the account.
Conclusion
Hosting a static website on Azure Storage removes servers from the equation entirely: upload files to the $web container and Azure handles the rest for a few cents per month. When the site outgrows static hosting — needing a database or server-side logic — you can graduate to the VM and managed database setups covered in our other Azure guides.
Related reading: Azure Blob Storage Tiers: Hot, Cool, and Archive Guide