Search code examples
azurecontinuous-integrationcontinuous-deploymentazure-logic-appsapplication-settings

setup logic app variable value at release time - http calls


Very shortly, I have 2 questions:

  1. how can we setup logic app variable value at realease time (for example)...
  2. Or how can logic app read values from settings file?

My actual environment:

I have 2 azure "environments", in other terms 2 azure resource groups that contain each the identical ressources and configurations.

Azure
|
|__Dev resource group : logic app + api App + .... other resources
|__Prod resource group: prod logic app + prod api App + .... other prod resources

Inside my logic Apps I have http endpoint call steps.

here

Actually both logic apps (prod logic app and dev logic app) are calling the dev api app endpoints (same api app on dev environment) because my problem is that I couldn't find a way to transform the value of the url inside the logic app http calls.

What i am trying to do is to change the base url value underlined in the image above by the adequate api app url of each environment (dev and prod) like following :

Dev api app url is : https://pwfotcapiapp

Prod api app url is : https://pwfprodotwapiapp...

I tried to set up the api app base url in a variable in appsettings.json and transform it at deploy time. It was ok but i couldn't set the base url value because i couldn't find a way to read appsettings.json variables from logic apps.

I Have a Ci/Cd Pipeline that creates or updates adequate resources on each resource group and does variables transformation successfully:

ci cd

So, in other words i have :

2 environments, 2 web apps (api apps), 2 logic apps

==> I want to be able to setup each logic app http calls url values to point a different web app (api app) at release time or to find a way to read appsettings values from logic app.

Any contribution would be appreciated

EDIT:

I Use Visual Studio to Develop My logic app

The trigger for my build is the commit, then the drop (build artifact drop) is the trigger for deploy pipeline.


Solution

  • I just tested logic app with template parameters.

    I used the default example for developing logic app with visual studio.

    I’ve parameterized both the base URL for the RSS feed and the mail to value. The steps are as follows –

    1. Declare template parameter. The defaultValue is not mandatory. Step1
    2. Replace the strings inside the fields by replacing with the parameter call. Step2
    3. Then you can also override these parameters in parameter file as well. Step3
    4. You can also override the value of parameter in CD pipeline enter image description here

    The precedence of the values are “LogicApp.json” < “LogicApp.parameters.json” < “override in CD pipeline”.

    For this example you can see that I used “google.com” as default base URL. But I override it in parameter files. Also I have three different email address in different files. So the email address was used as presented in CD pipeline overriding both the default declaration and the parameter file.

    But the base url is used as mentioned in the parameter file. So if you have different stage/task for deploying the logic app to development and production environment, you can use either way.