Search code examples
azureazure-devopsazure-pipelinesazure-logic-appsazure-logic-app-standard

Initiate Azure DevOps Release Pipeline from Logic App and Retrieve Environment Variable Output from the pipeline


I'm working on automating a release pipeline using Azure DevOps and a Logic App. The goal is to initiate the release pipeline from the Logic App when an HTTP request is received and then to retrieve the output of an environment variable from the Azure DevOps pipeline to use it in the next stage of the Logic App.

Below is a summary of what I am trying to achieve and the issues I am encountering:

Steps:

  1. Initiate Release Pipeline: Use a Logic App to start an Azure DevOps release pipeline.

  2. Retrieve Environment Variable: Extract the output of a specific environment variable from the Azure DevOps pipeline.

  3. Use Environment Variable in Logic App: Use the retrieved environment variable in the subsequent stage of the Logic App.

Logic App

I have encountered a couple of issues that I'm unable to resolve:

  1. Infinite Loop with Delay: I added a delay to wait for a pipeline stage to complete successfully, but it results in an infinite loop.

  2. JSON Parsing Issue: I tried to retrieve output environment variables of the pipeline using a parse JSON stage, but it is not functioning as expected.


Solution

  • Below design worked for me:

    enter image description here

    then:

    enter image description here

    then:

    enter image description here

    Here I have taken Result in Compose to get the result of build pipeline, take it and then use Parse Json as you will get to know what is the type of output/result it is giving and then use respective schema according to it.

    Output:

    enter image description here

    enter image description here

    The issue is not with design as the design worked for me.