Corticon.js Deployment on Microsoft Azure Functions


Deploy Progress Corticon.js Decision Services on Azure Functions to accelerate deployment and simplify operations at scale of your application’s business rules.

Corticon.js enables business users, domain experts, and JavaScript developers to define rules to automate critical business decisions. You can define rules, package them into fully deployable business decisions, and send them sent to JavaScript's compatible receptors. 

This tutorial will demonstrate deploying a rental car decision service generated by Corticon.js on Azure Functions. To prepare for the tutorial, the only Azure web portal interaction that is necessary, is signing up for Azure. The guide is currently Windows based and assumes an existing Azure account. You may choose to forgo the shell-instructions and retrace the steps outlined here in the Azure web console. Essentially you will have to follow this guide, placing the contents of everything under the CarsDecisionService directory in the file. You may also use Visual Studio Code with the Azure extension and follow this guide. NB: MS Visual Studio only supports deploying .NET/C# based projects.

The decision service we will be deploying in this tutorial is based on a typical rental car damage waiver insurance scenario. The end-result will be a fully functional web service, that is publicly available on the internet and can be integrated into any frontend application. As input this service expects driver information such as age, gender, driving experience and the desired collision damage waiver plan (‘Full’ or ‘Limited’). It will then output a calculated insurance premium based on the driver details provided. Rental car insurances usually rely on accident statistics for calculating the premiums. Therefore, younger drivers identifying as male typically face much higher premiums than non-male and/or older drivers (gender is not a binary spectrum).  


  • CarsDecisionService - The project/app container which can hold various functions. Its configuration is largely auto generated using CLI tools. 
  • CarsDecisionService/RentalInsurance - The node HTTP endpoint which makes the CorticonJS DS available for calling. This is an actual Azure Functions function.  
  • Createapp.bat - A Windows Batch Script that runs the necessary Azure CLI Commands to create the Azure Functions Deployment environment in the cloud.  
  • testCarsPayload.json - A sample JSON that can be used as a request body to verify the DS is working correctly - (look for a “status: success” in the response) 

System Prerequisites/ Tested With

  • (Optional) A good shell that also comes with git couldn't hurt (e.g. cmder) 

Setup project & verify local run

  • (Optional) Install curl to ultimately test the HTTP endpoint or use a HTTP Client of choice (Insomnia, Postman etc) 
choco install curl  

  • (Optional) Install latest LTS node, if not installed:  
choco install nodejs-lts 

  • Install Azure Functions Core Tools CLI globally (ie accessible from any project) 
npm i -g azure-functions-core-tools@3 --unsafe-perm true 

  • Then clone this repo into a work directory of your choice (If you want to use the CLI tools to create your own Functions-project, jump to the bottom) 
git clone  
  • In directory corticon.js-samples\Azure\CarsDecisionService install the Cars Corticon DS bundle from GitHub by executing 
npm install  

  • And finally run the Function in a local Azure environment  
func start  

You should see output similar to this, which means your service is available locally: <br bcx0"="">RentalInsurance: [GET,POST] 


You can verify  that it’s running correctly by POSTing the the HTTP endpoint:  

corticon.js-samples\Azure\curl --request POST --url  

http://localhost:7071/api/RentalInsurance --header "content-type:  

application/json" --data @testCarsPayload.json 

Finished! You should have a Corticon decision service running in a node HTTP service shell running in a locally emulated Azure environment. 

Deploying to Azure Functions

This is the main reason why you clicked on this tutorial. If you haven't signed up for Azure yet, please do so now.  
  • Install the Azure CLI (az) globally from anywhere in your file system 
choco install azure-cli 
  • Once installed, log into Azure. This should open a web login: 

  • Then cd to corticon.js-samples\Azure and run  

This sets up a few Azure cloud services: a resource group, a storage account and an app service/function container (+ app insights and service plan automagically). For detailed settings like deployment regions check the batch file. NB: on a trial plan, any other region than “eastus”results in subsequent errors, either when creating the storage engine or the function container.  

  • Now that all the admin is out of the way you can finally deploy your Corticon DS to Azure; in corticon.js-samples\Azure\CarsDecisionService  please execute 
func azure functionapp publish CarsDecisionService 

  • This publishing step may occasionally time out, but will ultimately deploy the project. If successful, you should see something along these lines:  
Functions in CarsDecisionService: 
RentalInsurance - [httpTrigger] 
Invoke url: 

  • The code-token is important! You can and should verify that everything is setup correctly by modifying the URL in the curl statement from above to: 
corticon.js-samples\Azure\curl --request POST -- 
url --header "content-type:  
application/json" --data @testCarsPayload.json 

Your cloud call should not only return a 200 OK, but also echo a slightly modified JSON, returning an insurance premium rate and adding a "status": "success" in the JSON. 

You have successfully deployed a Corticon.js Decision Service in the (Microsoft) serverless cloud. 

Create your own Service

  • To create the scaffolding for a node/javascript based Azure Function container, please run in some other working directory e.g. func init MyOwnDecisionService --node 
  • To actually create a function endpoint/handler within that container, you could run for instance 
func new --template "Http Trigger" --language "node" --name  


This would create code for an HTTP endpoint responding to GET and POST. There are other languages and templates available.  

  • In our sample, Corticon.js DS bundle is added as an npm dependency on the container level, therefore, it would be available to all functions in that container. It is also perfectly viable to just add it on a function level or add the bundle to the project as a hard dependency. If npm sounds good, you can add a dependency to the containers package.json by: 
npm install –save rental-insurance@git+ ice.git 

Now you have successfully utilized Corticon.js Azure functions!   

Connect any application to any data source anywhere

Explore all DataDirect Connectors

Need additional help with your product?

Get Customer Support