Why are you not using Azure Static Web Apps?!

So, I came across this blog the other day…

Host Static Web Sites for Free in Azure

Have a simple site that’s just html, css, javascript and other static content? You can host it for free in Azure. Not only is it free to host it is much easier to maintain than most off the self content management systems.

This sparked my interest, but then the kicker…

What about SSL? As soon as you add a custom domain SWA will automatically get an SSL cert that matches your domain. It will renew as needed- you need to do nothing else!

Wait, what?

I have a personal website that is a static site built with react (using create-react-app). Its stored on github, no actions or any other CI/CD scripts. At the moment, I pay for hosting and have yet to sort an SSL certificate so I thought I’d check it out.

Wow!

I was not prepared for how quick and easy it was! I mean, it took me literally 5 minutes.

  1. Sign into the Azure portal
  2. Go to Static Web Apps
  3. Click Create
  1. Select a subscription, resource group and name for your static web app
  2. Select the free tier and most appropriate region
  3. Select Github and sign in
  4. Select your repo and branch
  5. Select your build details
  1. Create it.
  2. And that’s basically it!

As part of the creation process, it

  • automatically created a github workflow that builds and deploys my app, including push and PR triggers
  • committed this to the repo
  • generated a custom hostname and SSL certificate
  • deployed and hosted my app

It’s just so simple

I followed a few extra steps to set up my custom domain, and now have my personal site hosted for free on azure!

Further reading

There are other ways to do this (via VS Code for example), and other basic templates for different frameworks and static site generators. The docs are really helpful…

Azure Static Web Apps
Azure Static Web Apps Docs
Create via the Portal
Configure Custom Domains