At the risk of never getting around to picking up Kotlin, I’ve been revisiting other topics this weekend, namely updating last week’s Terraform example and figuring out the new features for static hosting on Azure, which I need to set up a little app I’m doing.
As it turns out, a preview of static websites on Azure storage was actually announced in this Build 2018 video. It was a fairly low-key affair, which I only noticed earlier in the week.
But since it’s public, you can get started using it right away–all you need to do is log in to the Azure Portal through aka.ms/staticwebsites, and you should have access to it.
The service is still only available in
US West Central, so you should create a storage account in that region. Once you do that, you get a new
Static website (preview) option in the portal settings blade:
To publish your site, all you need to do is upload your files to the newly created
$web container. The canonical way to do so with a GUI is usually through Azure Storage Explorer, but I’m using Mountain Duck because it provides a virtual volume on the Mac, which is much nicer (if a trifle less efficient):
To add a Cloudflare-managed
CNAME to the storage account, you should first set the record to
DNS only in the Cloudflare dashboard until it’s validated. Otherwise it obviously won’t resolve properly back to Azure.
Once you’ve bound the new domain name to the storage account, it then works exactly like you’d expect. I’ve had zero issues with CORS, content types and related stuff up until now, but I’ve barely gotten started with the app (it’s a simple single-page app that renders selected Azure metrics, something that I’ll write about at a later date).
This opens up a lot of possibilities for this site (I’ve been meaning to get it off a VM for a while), but in between fiddling with REST APIs and the need to fix a
maven build, I’ll get back to exploring that some other weekend…