How to use a Cloudflare origin certificate on an Azure App
-
I am assuming that you followed my guide to Setup a Cloudflare Origin Certificate.
- Log on to a Linux based system of any type.
- If you like annoying, and you might since you are using Azure, feel free to get
openssl
setup on Windows. Just don't ask me.
- If you like annoying, and you might since you are using Azure, feel free to get
- Save the origin certificate file as
origin.domain.pem
. - Save the origin key file as
origin.domain.key
. - Save the chain file (ECC version) as
chain.domain.pem
.
You should end up with this.
[jbusch@dt-jared Azure]$ ls -las total 24 4 drwxrwxr-x. 2 jbusch jbusch 4096 Apr 28 23:14 . 4 drwxrwxr-x. 3 jbusch jbusch 4096 Apr 28 23:10 .. 4 -rw-rw-r--. 1 jbusch jbusch 939 Apr 28 23:10 chain.bundystl.com.pem 4 -rw-rw-r--. 1 jbusch jbusch 241 Apr 28 23:11 origin.bundystl.com.key 4 -rw-rw-r--. 1 jbusch jbusch 1151 Apr 28 23:11 origin.bundystl.com.pem
- Create the PFX certificate with with a passcode using
openssl
[jbusch@dt-jared Azure]$ openssl pkcs12 -export -in origin.bundystl.com.pem -inkey origin.bundystl.com.key -out origin.bundystl.com.pfx -certfile chain.bundystl.com.pem Enter Export Password: samepasswordtwice Verifying - Enter Export Password: samepasswordtwice [jbusch@dt-jared Azure]$
-
Add a cname in Cloudflare for your domain pointing to your appservice.azurewebsites.net. Make sure the orange cloud is unchecked for now.
-
Sign in to Azure, go to the App services, click on your app, and then
Custom domains
.
-
Click Add custom domain and put in the domain in the box and click validate.
-
Wait a moment while it checks for hte DNS record, and then click the Add custom domain box above the two green checks :white_heavy_check_mark:.
-
Click Add binding on the prior panel.
-
Click the Upload PFX Certificate button.
-
Browse to the file and enter the password, then click upload.
Save it off the Linux machine if you need to back to your desktop.
-
It will upload and thn you have to choose the certificate and type. Each box only has one option.
-
Choose the only options and click Add Binding at the bottom.
-
You will see the new domain showing and have the secure check mark.
-
Go back over to Cloudflare and turn on the orange cloud.
-
Optionally, this depends on the other DNS entries you have with the orange cloud all having valid SSL, you can enable Strict SSL.
- Log on to a Linux based system of any type.