Monday, July 19, 2021

Deploying an Azure Logic Apps Standard workflow through Azure DevOps Pipeline

 

In this article, I am providing the step-by-step instructions on deploying a workflow to a Logic App Standard resource through Azure DevOps CI/CD pipelines.

 

Create an Azure DevOps Project:

 

You can login to Azure DevOps and create a project under an existing organization or even create a new organization as below.

Projects - Home (azure.com)

Shree_Divya_M_V_0-1625853190474.png

 

Choose a name and visibility for the project.

Shree_Divya_M_V_1-1625853190480.png

 

Build a CI pipeline:

 

1. Create a GitHub Repository with your project files- Host.json, proxies.json and Workflow Folder.

Shree_Divya_M_V_2-1625853190485.png

2. Generate Connections.JSON file

 

To generate Connections.json using managed identity, it is required to use a PowerShell Script to load all the API connections present in the resource group.

               Below is a sample PowerShell Script to perform this.

https://github.com/ShreeDivyaMV/LogicAppsSamples/blob/18a6a559793707cc380b934ea572eaf07edbac66/azure-devops-sample/.pipelines/scripts/Generate-Connections.ps1

 

3. Create the build pipeline YAML file:

You can refer the below file for the build pipeline. Save this in your repository.

https://github.com/ShreeDivyaMV/LogicAppsSamples/blob/18a6a559793707cc380b934ea572eaf07edbac66/azure-devops-sample/.pipelines/classic/ci-pipeline.yml

 

Please modify the subscription ID, Path to the Generte-connections.ps1 file, source folder and workflow name as appropriate,

Shree_Divya_M_V_3-1625853190489.png

 

 

4. Go to Azure DevOps project which was created in the first step. Create a new pipeline and choose the source as GitHub.

 

Shree_Divya_M_V_4-1625853190494.png

 

 

 

 

 

Shree_Divya_M_V_5-1625853190498.png

 

5. Select the repository, choose the build pipeline and save it.

 

Shree_Divya_M_V_6-1625853190501.png

 

 

Shree_Divya_M_V_7-1625853190505.png

 

Shree_Divya_M_V_8-1625853190507.png

 

 

 

 

 

 

 

Build a CD pipeline:

 

1. Create a CD pipeline in the GitHub Repository. You can refer the below file. Please update the variable file path and add if any connection parameters are there, add them under app-setting as below

https://github.com/ShreeDivyaMV/LogicAppsSamples/blob/18a6a559793707cc380b934ea572eaf07edbac66/azure-devops-sample/.pipelines/classic/cd-pipeline.yml

 

Shree_Divya_M_V_9-1625853190512.png

 

 

2. Update the variable values in the variable YAML file.  https://github.com/ShreeDivyaMV/LogicAppsSamples/blob/18a6a559793707cc380b934ea572eaf07edbac66/azure-devops-sample/.pipelines/classic/variables/pipeline-vars.yml

 

The value for the variable “devServiceConnection” can be retrieved from the service connections tab of Azure DevOps Pipeline settings.

 

Shree_Divya_M_V_10-1625853190521.png

 

3. Create another pipeline under the Azure DevOps project referring to the file created above.

Shree_Divya_M_V_11-1625853190524.png

 

Run CI and CD pipelines to build and deploy the workflow:

 

1. Choose the CI pipeline from the Azure pipelines project and click on ‘Run Pipeline’. You can view the status and logs on the same screen.

2. Once it is successful, run the CD pipeline and verify in the Azure portal that workflow is deployed and running fine.

 

Shree_Divya_M_V_12-1625853190527.png

 

 

 

Note: This sample is deploying a workflow to an existing logic app and uses existing connections. In case you would like to deploy a Logic App as well through the CI/CD pipelines, you can refer the repository- logicapps/azure-devops-sample at master · Azure/logicapps (github.com)

 

 

References:

 

GitHub Repository used in this example: LogicAppsSamples/azure-devops-sample at master · ShreeDivyaMV/LogicAppsSamples (github.com)

Base Repository: logicapps/azure-devops-sample at master · Azure/logicapps (github.com)

Set up DevOps for single-tenant Azure Logic Apps - Azure Logic Apps | Microsoft Docs

 

Posted at https://sl.advdat.com/3BmrkQ6