You are currently viewing Set up a website using WordPress on Azure (Part 2)

Set up a website using WordPress on Azure (Part 2)

In part 1 of this blog post we have set up our WordPress website and made sure it can only be accessed via HTTPS. In this part we are going to link our newly created website to a custom domain name.

Prerequisites

In order to use a custom domain name for your website you must own one. There are many organisations that will help you buy a domain name, like GoDaddy. I used TransIP for this. It does not matter from which company you bought your domain name, as long as you have full control over the DNS records.

Setup steps

To set up your custom domain, follow the following steps:

  1. go to the app service MagicAzureWebsite in your azure portal
  2. select the custom domains tab
  3. select the Add custom domain text that is somewhat hidden. It is highlighted with a red circle in the next picture
  4. Now you can type in your desired domain name. This can be your entire domain (like magicazure.com), or a subdomain (like website.magicazure.com or www.magicazure.com). You can repeat these steps if you want your website to react to both at the same time.
  5. Now press validate
  6. Of course validation will fail, since we have not proven to Azure we own the domain. This is no problem. At the bottom you will see the expected DNS records.
    1. For a sub domain azure will expect a TXT record and a CNAME
    2. For the whole domain Azure will expect a TXT record and an A record.
  7. You can add the desired record to your DNS settings. Best do this in a different browser session and leave your Azure page open.
  8. After you finished the previous step you can try to press validate again. It might take some time, but in my experience Azure identifies the updates immediately.
  9. Do not forget to press the Add custom domain button.

By following these steps, your custom domain name is linked to your website. However, you will see the website being identified as not secure.

Add the certificate

In order to make the website accessible via HTTPS we need a certificate. Normally a certificate will cost you money. Furthermore, most certificates are only valid for a limited duration. Luckily there is a free (as in no extra money) way around this.

  1. In the Azure portal go to the app service again
  2. Check the tab TLS/SSL settings
  3. At the top, select the Private Key Certificates (.pfx)
  4. Now an option will appear where you can select Create App Service Managed Certificate
  5. You can select the custom domain name you created above and then press create
  6. After a few minutes a certificate is created for you. However, this certificate is not yet used by our website. We have to go back to the Custom domains tab
  7. Next to our custom domain name we can select the Add Binding text.
  8. In the new pop-up we select
    1. Our custom domain name,
    2. The Private Certificate we just created that has the same name as our custom domain name
    3. The TLS/SSL type. I could only select SNI SSL
  9. Press Add Binding

After all these steps, our website is accessible via HTTPS with a valid certificate.

Leave a Reply