Azure Blob Storage offers a cost-effective way to host a static website directly from a storage account. This method is ideal for sites that don't require server-side processing, such as documentation sites, single-page applications (SPAs), or marketing landing pages.
Navigate to your storage account in the Azure portal. Under Data management, select Static website.
Toggle the status to Enabled. Specify your index document name (e.g., index.html) and your error document path (e.g., 404.html).
Once enabled, Azure creates a special container named $web for your website's content. You'll also get a primary endpoint URL for your website.
Upload all your static website files (HTML, CSS, JavaScript, images, etc.) to the $web container in your Blob Storage account. You can use the Azure portal, Azure CLI, Azure Storage Explorer, or SDKs for this.
# Example using Azure CLI to upload files
az storage blob upload-batch --account-name <your-storage-account-name> --source <path-to-your-website-files> --destination '$web' --auth-mode login
Make sure your index.html file is at the root of the $web container.
After uploading your files, your static website will be accessible via the primary endpoint URL provided in the Azure portal. It might take a few minutes for the changes to propagate.
The primary endpoint typically looks like this:
https://<your-storage-account-name>.z20.web.core.windows.net/
To use a custom domain name and enable HTTPS, you can integrate Azure CDN with your Blob Storage static website.
index.html file to handle deep linking and page refreshes correctly.$web origin.
Azure Blob Storage provides a robust, scalable, and economical solution for serving static websites. By following these steps, you can quickly deploy your static content and make it available to users worldwide.