◷ Reading Time: 4 minutes
If you have already deployed models including different environment settings, you can change assigned settings using the FlexRule CLI Update command.
In order to change environment settings in the existing deployed model, there is no need to publish and re-deploy the model; You use the update command and pass the new environment settings.
FlexRule CLI provides two options to update the environment settings:
- Using JSON settings
- Using Environment Profile Name
Using JSON Settings
You can use the command syntax below to update an existing app environment using JSON data.
fr.exe update --to azure --function <value> --subscriptionid <value> --tenantid <value> --clientid <value> --secret <value> --region <value> --resourcegroup <value> --environmentFrom "json" --environmentValue <value>
- to: This is the target environment to deploy the package; At this point it supports only Azure.
- function: The Azure Function Name.
- subscriptionid: Azure Subscription Id.
- tenantid: Azure Tenant Id.
- clientid: Azure Client Id.
- secret: Azure client secret for authentication.
- region: Datacenter where the function app is deployed.
- resourcegroup: Azure resource group which has all the related resources.
- environmentFrom: This should be “JSON”.
- environmentValue: This should be a JSON that includes values of. “EnvironmentParameterName” (binding parameter) and “EnvironmentParameterValue” from the project.
A valid JSON format is as follows.
"{EnvironmentParameterName: 'Connection', EnvironmentParameterValue: {ConnectionString: ""data source=172.171.249.142;user id=admin;password=XXXX;initial catalog='Car-Insurance QA';Persist Security Info=true""}}"EnvironmentParameterName
EnvironmentParameterName is the binding parameter that should be defined in the model.

EnvironmentParameterValue
EnvironmentParameterValue is the value to be set for the binding parameter during execution. Passing JSON format value for the Environment parameter is similar to the Business Formulas we created in the FlexRule Designer to set the value for different environments.

Example
fr.exe update --to azure --function "EnvironmentSettings2-zr0cqw" --subscriptionid XXXX --tenantid XXXX --clientid XXXX --secret XXXX --region "australiaeast" --resourcegroup Dev-Test --environmentFrom "json" --environmentValue "{EnvironmentParameterName: 'Connection', EnvironmentParameterValue: {ConnectionString: ""data source=172.171.249.142;user id=admin2;password=Kw!AJdD.6ri@;initial catalog='Car-Insurance QA';Persist Security Info=true""}}"Using Environment Name
To update environments using the environment profile name, you can use the command syntax below
fr.exe update --to azure --function <value> --subscriptionid <value> --tenantid <value> --clientid <value> --secret <value> --region <value> --resourcegroup <value> --environmentFrom "name" --environmentvalue <value> --project <value> --runtime <value> --license <value>
- to: This is the target environment to deploy the package. Currently, it only supports Azure.
- function: The Azure Function Name.
- subscriptionid: Azure Subscription Id.
- tenantid: Azure Tenant Id.
- clientid: Azure Client Id.
- secret: Azure client secret for authentication.
- region: Datacenter where the function app is deployed.
- resourcegroup: Azure resource group which has all the related resources.
- environmentFrom: This should be “name”
- environmentValue: This is the environment profile name that you defined in the project.
- project: Absolute path to the .frpj file in the project folder
- runtime: This specifies the location where FlexRule Runtime is installed.
- license: Path to the FlexRule Runtime license file. It is generally named as flexrule.license.lic.
Example
fr.exe update --to azure --function "EnvironmentSetting-jtiiekw" --subscriptionid XXXX --tenantid XXXX --clientid XXXX --secret XXXX --region "australiaeast" --resourcegroup Dev-Test --environmentFrom "name" --environmentvalue "QA" --project "C:\Users\User\Documents\FlexRule\Projects\Environment Settings\Environment Settings.frpj" --runtime "C:\Users\User\Documents\.flexrule\9.1.109" --license "D:\Azure Credentials\FR Cloud License.lic"