In this article I will demonstrate the necessary steps to set up a node.js server running https, hosted in Azure.
This article is a combination of my own work and a conglomeration of reference point blog articles which I had to find to achieve all of this.
Creating a node.js site on Azure
If you follow the instructions on this site you should be able to create an azure site (Get started with Node.js web apps in Azure App Service)
Creating a custom domain
Once you have registered your new domain (in my case marky.co) you need to go to the azure portal and follow the instructions posted here (Configuring a custom domain name for an Azure cloud service). You cannot do this on your free tier though and this where you have to chose your plan carefully. To be able to interact with Office Add-Ins I need my service to be SSL enabled.
Once you have selected a Basic plan you should get the following options
Assign your site and as the instructions stated – you can “Bring your domain” by changing the CName within your domain name provider DNS management tools.
There are a number of methods for getting an SSL certificate but I have taken to doing it for free – you can use the same process I detailed here for exposing your node server to manually collect the letsencrypt certificates (Using Let’s Encrypt to create an SSL certificate for my Bluemix hosted web site) to create the .pem files.
To turn the .pem files into .pfx files you need to follow the openssl instructions here (How To: Get LetsEncrypt working with IIS manually)
openssl pkcs12 -export -out “certificate.pfx” -inkey “privkey.pem” -in “cert.pem” -certfile chain.pem
The certificate.pfx file can then be loaded into the azure portal. When you import the certificate successfully it is displayed on the main blade automatically.
Add the SSL binding
aaaah we love the cloud….
IMPORTANT – Restart your instance and there we go
In this article we have seen how to deploy an instance of node.js on Azure, applied a custom domain to it, created an SSL certificate and added to an azure instance. Once this is complete you should have an SSL secured node.js instance running which can then be used for Office Add-in deployments.