I’ve recently been playing around with Cloudflare workers. As part of this, I wanted to experiment using them against an Azure App Service, but to do this, you need a custom domain. In this post, I’ll cover how to create a new domain, and then how to register that against an app service and add a TLS certificate, all without leaving the Azure Portal.
Register a New Domain
To register a new domain, you need to select the App Service Domains resource:
In the App Service Domains, you can create a new domain:
Once you’ve created the domain, you can register it against the App Service.
Register the Domain Against an Azure App Service
This assumes that you have an App Service to register against a domain. The example that I’m using here is just a new templated MVC app that was deployed directly to Azure.
Go into the Azure App Service and select Custom domains:
Inside the Custom domains blade, select Add custom domain. As shown in the diagram above, you’ll be asked to enter the domain, and to validate that domain. You’ll then select Add custom domain.
That’s actually all there is to it; you’ve now registered the domain against the app service. However, if you try to navigate to the domain, you’ll see that it doesn’t have a valid certificate – looking in the Custom domains blade, we can see why:
Let’s now add a certificate. This used to be a process that involved a lot of faffing about, and it had been greatly simplified.
To Add a TLS Certificate
Select the TLS / SSL settings blade:
Then select Create AppService Managed Certificate, as shown in the diagram above. This should present you with something similar to the following:
Click Create and this will create the certificate for you. This might be a good point to go and get a brew, as it takes a fair while.
When it’s finally finished, you’ll see something like this:
The last step is to register the certificate with the domain.
Register the Certificate with the Domain
We’re on the home straight now. Go back to Custom Domains:
As you can see, the domain is showing as Not Secure. Select Add Binding (as shown above), and the following dialog (or something similar) should appear:
If you now select Add Binding that should register the certificate against your domain.