I have deployed the Logic App standard using the Bicep template and I am able to deploy the workflows by download it from portal zip and deploying it using the function app deployment task using azure devops I am facing issue in updating the parameters.json file whose value has to be updated according to the environment.
Is there a way to update the parameters.json
like we do in appsettings.json
for function app deployment?
For example: my connection.json
has function app connection string:
"azureFunctionOperation-1": {
"function": {
"id": "/subscriptions/@{appsetting('WORKFLOWS_SUBSCRIPTION_ID')}/resourceGroups/@{parameters('azureFunctionOperation-1-ResourceGroup')}/providers/Microsoft.Web/sites/@{parameters('azureFunctionOperation-1-SiteName')}/functions/Get-Dummy"
},
"triggerUrl": "@parameters('azureFunctionOperation-1-TriggerUrl')",
"authentication": {
"type": "QueryString",
"name": "Code",
"value": "@appsetting('azureFunctionOperation_11_functionAppKey')"
},
"displayName": "Get"
}
and parameter.json
has value which is environment specific:
{
"azureFunctionOperation-1-ResourceGroup": {
"type": "String",
"value": "dev-rg"
},
"azureFunctionOperation-1-SiteName": {
"type": "String",
"value": "get-dev"
},
"azureFunctionOperation-1-TriggerUrl": {
"type": "String",
"value": "https://get-dev-gafmfdafbsbzgda5.westeurope-01.azurewebsites.net/api/get-dummy"
}
}
Is there a better way to manage these settings, or any command to update the parameters.json
only?
I tried looking for way to update through the Bicep, but I found it only for consumption based
Approach 1 - Pipeline Replacement
There are two approaches you can take, one of which is to do it during your CI/CD pipeline. Although it's not BICEP, the concept is likely the same.
https://github.com/Azure/logicapps/blob/master/github-sample/.github/workflows/logicapp_deploy.yml
You'll see a step at the bottom of that pipeline which swaps the parameter file out for a parameter file that is specific to the environment.
Approach 2 - Use AppSettings
You can use AppSettings instead of hardcoding the values. This is the approach I usually take, I find it to be much easier and doesn't require a redeployment and is already in line with your thinking.
Example:
{
"Environment": {
"type": "String",
"value": "@appsetting('Environment')"
}
}