1. Home
  2. FlexRule CLI
  3. CLI Scenarios
  4. Deploy your Models to Azure Functions through CLI

Deploy your Models to Azure Functions through CLI

◷ Reading Time: 4 minutes

In this page we are going to use the FlexRule CLI to publish a FlexRule project and then deploy it to the Azure. There are two approaches to publish:

Clone a project from GitHub

Run Command Prompt as administrator and navigate to a folder where you want to clone your project from GitHub repository .

git clone <reposiory-url>

Publish Project

Navigate to FlexRule CLI installation folder and execute the publish command to publish your cloned project from Git Hub.

cd <FlexRuleCLI installationfolder location> 

Using Logic Document

One of the approaches is to publish your project using Logic Document.

fr.exe publish --project "D:\projects\Publish-Profile-with-Delivery-Cost-Calculator\Delivery Cost Calculator.frpj" --method package --destination "D:\projects\Publish\DeliveryCost.frdp" --includeAssemblies True --runtime "C:\Users\<user-name>\Documents\.flexrule\9.0.201" --logic "Calculator.xml" --packageidentifier "1" --packageversion "1" --serviceversion "1"

Using Publish Profile Document

Other approach is to publish your project using Publish Profile Document.

fr.exe publish --project "D:\projects\Publish-Profile-with-Delivery-Cost-Calculator\Delivery Cost Calculator.frpj" --method package --destination "D:\projects\Publish\DeliveryCost.frdp" --includeAssemblies True --runtime "C:\Users\<user-name>\Documents\.flexrule\9.0.201" --profile "Profile.xml" --packageidentifier "1" --packageversion "1" --serviceversion "1"

It will create a .frdp file in your selected destination.

Deploy

Deploy your published .frdp file into Azure using deploy command.

fr.exe deploy --to Azure --package "D:\projects\Publish\DeliveryCost.frdp" --license "D:\Azure Credentials\flexrule.license (3).lic" --includeassemblies true --runtime "C:\Users\<user-name>\Documents\.flexrule\9.0.201" --includeassemblies true --function Supplier --subscriptionid xxxx --tenantid xxxx  --clientid xxxx --secret xxxx --region "East US" --resourcegroup xxxx --plan SharedD1

Test

After a successful deployment you will get a Execute URL and Service URL on the CLI screen to access your deployment.

In here we will be using Postman to test the deployed package.

Accessing the Package using Execute URL

CLI AZURE

The invocationId is generated as {RequestId}.{RunId} where the RequestId comes from the cloud platform for the function, and RunId comes from FlexRule engine executing a specific request.

Accessing the Swagger Endpoint using Service URL

Updated on December 2, 2022

Was this article helpful?

Related Articles