Mark Oliver's World

Posted: 22/03/2021

Setting Up My Custom Domain

So the blog is now hosted in Azure static web apps, but its no great using the default random hostname they give you.

Custom Domains to the rescue!

Azure static web apps give you this for free (including HTTPS!), and its really easy to setup.

You can follow the official docs here

You need :

  • a registered domain.
  • Access to its DNS settings to set a CNAME record
  • The Azure Portal.
  • a sub domain name you like (you cannot use the root domain, so blog.xyz.com is ok but not xyz.com)

In your DNS settings, add a CNAME record with HOST NAME set to "blog" and the "points to" set to the url of your staticapp e.g.
If I want to setup blog.markoliver.website as my blog website pointing at my static web app called zealous-pond-0d09d0c03.azurestaticapps.net, I set HOST name to "blog" and "points to" set to "zealous-pond-0d09d0c03.azurestaticapps.net"

Then in the Azure portal, locate "custom domains" option under the static web app section you want, and add the "blog.markoliver.website" in the top box, and hit the Validate button. Wait a few minutes, and you are done.

Now after a few hours (DNS takes a while to propagate around the world), you can visit blog.markoliver.website and you will find the Azure static web app. All for free (excluding the domain registration)!

Simples!


Thanks for reading this post.

If you want to reach out, catch me on Twitter!

I am always open to mentoring people, so get in touch.