Last week, I created a new Office 365 organization since I moved from Australia to Canada, and creating a new one is the only way to move countries. Due to having a new organization, I also had to move my domain and update my DNS configuration for my email server and website which is hosted as an Azure Static Web App.
This short post will only be a rant about DNS configurations sucking and will contain a couple of notes for myself in case I have to update the settings again in the future.
I am using Office 365 Exchange to host my emails, Azure Static Web Apps to host my website, and Azure DNS to manage my DNS settings. Additionally, I am managing my domain with a third-party company that also has a DNS and Name Server configuration.
Setting up a new Office 365 organization is quite straightforward. Create a new account, select the plan you want, and purchase it. After you have set up the organization, open the Office 365 Admin Center and you will see a wizard that will guide you to set up your custom domain. All you have to do basically is to add a TXT entry to your DNS records to verify that you own the domain.
As I mentioned before, I am “using” a third-party DNS as well as the Azure DNS. Since I only want to use the Azure DNS, I removed all records from there and changed the Name Server to the name server of my Azure DNS zone.
In theory, configuring an Azure Static Web App with a custom domain is straightforward. Go to your Azure Static Web App, open the Custom domains pane and then follow these two guides: Set up a custom domain with Azure DNS in Azure Static Web Apps and Set up an apex domain with Azure DNS in Azure Static Web Apps.
This worked out just fine (except for the DNS propagation “problems” that just need some time) until I realized that my website works for https://programmingwithwolfgang.com but not when I use www. I already had this problem the last time I set up the Azure Static Web App but my domain provider has an option to redirect https://www.programmingwithwolfgang.com to https://programmingwithwolfgang.com so I never bothered with that. Now I had to learn that this option was not available anymore.
I have to admit that I didn’t really know what to do and so I tried just to add another custom domain to my web app, but this time with the www and it works. Now I have two entries there and use the one without www as my default. As a result, requests to https://www.programmingwithwolfgang.com get redirected to https://programmingwithwolfgang.com but that’s just fine for me.
Configuring DNS is still a pain in 2023 but if you follow the guides and test a bit, you should be able to get it going.