Fabian G. Williams aka Fabs

Fabian G. Williams

Sr. Program Manager, Microsoft @fabianwilliams.

Azure Web App DNS Gotcha

Creating an Apex Domain registration will error out if your DNS Zone is in a different subscription from your Web App by default

Fabian Williams

5-Minute Read

Azure Static Web App Gotcha

Why you should read this post

Are you contemplating 🤔 or have you built a Static Web Application using Microsoft Azure Static Web Apps and do you plan to use an Apex Domain as a part of your URL. 😳 In plain english that means do you plan to access your website by using https://sitenamehere.com without the www? If so then keep reading please. 😌 For what should be a simple task, I faced a GOTCHA 🔥 on 2 different levels that I’d like to share with you, Ive outlined them below, even though I have listed 3 items below the 3rd is more of an observation:

  1. If your non Microsft Azure DNS hosting provider does not support creating an ALIAS record for apex domains, you will have problems
  2. If you are using Azure DNS Zones ‘and’ you have your Azure Static Web App in a different subscription from your DNS zone, you will have problems
  3. (observation)If you have your own certificate and you want to use it rather than the managed one Azure gives you (as of the time of this writing), it will not work. Its managed only as opposed to what you can do with a regurlar Azure Web App.

My situation may be similar to yours

I use godaddy as my DNS provider and its not something I plan to change anytime soon, in fact most of my needs have been met for websites I host because I have been able to roll my own SSL certificates in the standard Web Apps that I used to host all of my sites in Microsoft Azure. FWIW I usually employ Wordpress blog sites. However a few weeks ago I decided to slim down and use Azure Static Web Apps as you can read in my A New Day blog post which changed the platform an how I go about managing my site. Another thing I like to do is to use an Apex domain as one way actually the chief way to get to my site, why… 🤔 its because its a shorter url to type and it’s cleaner. Anyway, thats my set up for the perils to come and how I solved them. The main point of this post is how to solve for the Apex domain in Azure so I will just tell you now that you cannot do an ALIAS record in GoDaddy (again, at the time of this writing)

GoDaddy Setup A Record

for 1, when you select A Record you can only do IP4 Addresses and if you try, you get the below

GoDaddy Setup A Record

Which means I have to do this elsewhere, where you may ask? Well lets try out Azure DNS.

Spinning up DNS Zones using Azure DNS

This is litterally too easy and you can find out how to do it here. I’ll also use this opportunity to show you my resulting DNS records from Azure DNS once I got it working below: FabsWill DNS Notice I have both a CNAME record pointing to my www whilst I also have a @ pointing to my ALIAS record on my Static Web App instance. Now the DOCS for how to set up the ALIAS record is quite explicit, simple steps and it has a tab to show you how to do it in Azure DNS or “Other DNS” for external. However, this is were for me it started to unravel 😡

What the Docs do not tell you

NB In my Azure envionment, I have my Static Web App in lets call it Subscription A and I have my DNS Zones ‘originially’ set up in Subscription B

If you are unfamiliar with what Azure Subscrptions are, think of them as seperate islands where your billing and assets reside, one does not see the other without you setting Role Assignments in essence inviting access from one to the other. But this is where I have an issue with how the flow is set up for creating ALIAS records in Azure Static Web Apps, because… I can select across my subscriptions, and I can see from one to the other in the configuraiton, its upon execution where things go hella wrong! Note the callouts below in Choose a subscription and Azure resource Azure Static Web Docs on Creating an ALIAS Record however when I click “OK” I got the below error: Action Failed to Create ALIAS and if you inspect the activity logs to get more details you will see: Action Failed to Create ALIAS - Details

How I went about and ulitmately fixed it

Well, I can tell you we have excellent support directly from the Azure Portal here at Microsoft, I used it, and got feedback to my problem in less than 1 hour. Ive redacted only the Subscription A and Subscription B details Support Ticket Resolution Information but you can pretty much see what they suggested as a resolution which would work but I didnt want to bridge the islands of Subscriptions. I have/had no reason to keep a DNS Zone in that subscription, it is quite simplier to just move the DNS Zone to the subscription that I have my Static Web App in. I did this by simply clicking on the resource and selecting “MOVE” and pointed it to my other subscription Moving Day for DNS I waited for a few minutes and bing bang boom… Moving Day for DNS complete

Summary

With those actions cited in the previous section I was able to resolve this issue, I no doubt believe that others may see this problem and is the reason I am blogging it. If the error was more descriptive than just Internal Error then I might not have but I hope this helps someone to spend minutes and not hours troubleshooting this issue. Now I have an Apex domain friendly URL at https://fabswill.com - go check it out please! 😊 Visit FabWill DOT COM

Chat about this?

Engage with me Click
Twitter @fabianwilliams
LinkedIn Fabian G. Williams

Or use the share buttons at the top of the page! Thanks

Cheers! Fabs

Recent Posts

Categories

About

Fabian G. Williams aka Fabs Site