In my work, I have a configuration that runs a logic app with specific parameters. To be honest, it was a pain to find how to pass a variable into my pipeline. So I want to share a full guide on how to run an Azure DevOps Build Pipeline from Azure Logic App and pass variables into the build pipeline.

Let’s first start with Azure Logic App. In Logic App I have created two tasks. First task is “When a HTTP request is received” so we can call the logic app with ease, and second is “Queue a new build”. Logic App Designer

Variables for the build pipeline go into the Parameters field as the JSON dictionary. In my build pipeline I will be use two test variables

{"mytest": "thisislogicapp", "pipelinevar": "mylogicapp"}

Rest of the fileds is pretty easy to fill out but I will leave a picutre just as a reference 😊

Quey a new build

Now let’s move to the Azure DevOps Build pipeline

This is how my build pipeline looks

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
- script: |
    echo '$(mytest)'
    echo '${{ variables.mytest }}'    
  displayName: 'display yaml var'

- script: |
    echo '$(pipelinevar)'    
  displayName: 'display pipelinevar'

Additionally, it’s important to note that setting up the variables in the YAML code for the build pipeline might not work as expected. Instead, follow these steps to set up variables:

  1. Navigate to the Azure DevOps Edit view for the pipeline.
  2. Click on “Variables” in the top right.
  3. Configure the variables, ensuring they are set to “Let users override the value.”

Variables

SetVariables

When this is all setup we can run our logic app and see that variables have changed.

Hope this helps you 👋.