Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Parametric Logic App With Azure DevOps

Article:
Viewed:  1919 
Posted On:  29/01/2020 18:00:16 
How to develop Parametric Logic App? How to do CI&CD Azure Logic Apps? 

 

In this article I am going to explain how to develop Azure Logic Apps with parameter for different-different environment. And how to do Azure DevOps for Logic Apps.


If you have below questions in your mind then this article will be very helpful for you.

  • How to create Azure Logic Apps for different environment ie: Dev, QA & Prod
  • How to deploy Azure Logic Apps using Azure DevOps
  • How to user Azure Repos git
  • How to develop Azure Logic Apps using Visual Studio

 

I have 2 part article.

# First Part:

Develop a Logic App with parameter file for Dev, QA and Production environment.

# Second Part:

Deploy this Azure Logic Apps using Azure DevOps

I am using below tools and services in this article.

1. Visual Studio 2017 with Logic App Tools 

2. Azure DevOps (CI & CD Pipelines)

In this Azure Logic Apps, I am going to design a recurrence and create a Blob in respective environment Storage Account.

1.png

Image 1.

#First Part:

Create Azure Logic Apps using Visual Studio 2017

2.png

Image 2.

3.png

Image 3.

 

It will add below files in your solution:

4.png

Image 4.

Now I did rename parameter file added more parameter file as per our environments.

5.png

Image 5.

Now right click on LogicApp.json and open with Logic App designer.

6.png

Image 6.

Now design your Logic App as per your business need.

7.png

Image 7.

8.png

Image 8.

LogicApp.json:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "logicAppName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "metadata": {
        "description": "Name of the Logic App."
      }
    },
    "logicAppLocation": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "allowedValues": [
        "[resourceGroup().location]",
        "eastasia",
        "southeastasia",
        "centralus",
        "eastus",
        "eastus2",
        "westus",
        "northcentralus",
        "southcentralus",
        "northeurope",
        "westeurope",
        "japanwest",
        "japaneast",
        "brazilsouth",
        "australiaeast",
        "australiasoutheast",
        "southindia",
        "centralindia",
        "westindia",
        "canadacentral",
        "canadaeast",
        "uksouth",
        "ukwest",
        "westcentralus",
        "westus2",
        "koreacentral",
        "koreasouth",
        "francecentral",
        "francesouth",
        "southafricanorth",
        "southafricawest"
      ],
      "metadata": {
        "description": "Location of the Logic App."
      }
    },
    "azureblob_1_Connection_Name": {
      "type": "string",
      "defaultValue": "azureblob"
    },
    "azureblob_1_Connection_DisplayName": {
      "type": "string",
      "defaultValue": "Connection_DEV_SA"
    },
    "azureblob_1_accountName": {
      "type": "string",
      "metadata": {
        "description": "Name of the storage account the connector should use."
      },
      "defaultValue": "sa4devenv"
    },
    "azureblob_1_accessKey": {
      "type": "securestring",
      "metadata": {
        "description": "Specify a valid primary/secondary storage account access key."
      },
      "defaultValue": "sdfghjklwertyuiocvbjrtg345678TEST=="
    }
  },
  "variables": {},
  "resources": [
    {
      "name": "[parameters('logicAppName')]",
      "type": "Microsoft.Logic/workflows",
      "location": "[parameters('logicAppLocation')]",
      "tags": {
        "displayName": "LogicApp"
      },
      "apiVersion": "2016-06-01",
      "properties": {
        "definition": {
          "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
          "actions": {
            "Create_blob": {
              "type": "ApiConnection",
              "inputs": {
                "host": {
                  "connection": {
                    "name": "@parameters('$connections')['azureblob']['connectionId']"
                  }
                },
                "method": "post",
                "body": "Test Blob @{utcNow()}",
                "path": "/datasets/default/files",
                "queries": {
                  "folderPath": "/destination",
                  "name": "RBlob",
                  "queryParametersSingleEncoded": true
                }
              },
              "runAfter": {},
              "runtimeConfiguration": {
                "contentTransfer": {
                  "transferMode": "Chunked"
                }
              }
            }
          },
          "parameters": {
            "$connections": {
              "defaultValue": {},
              "type": "Object"
            }
          },
          "triggers": {
            "Recurrence": {
              "type": "Recurrence",
              "recurrence": {
                "frequency": "Minute",
                "interval": 3
              }
            }
          },
          "contentVersion": "1.0.0.0",
          "outputs": {}
        },
        "parameters": {
          "$connections": {
            "value": {
              "azureblob": {
                "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'azureblob')]",
                "connectionId": "[resourceId('Microsoft.Web/connections', parameters('azureblob_1_Connection_Name'))]",
                "connectionName": "[parameters('azureblob_1_Connection_Name')]"
              }
            }
          }
        }
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/connections', parameters('azureblob_1_Connection_Name'))]"
      ]
    },
    {
      "type": "MICROSOFT.WEB/CONNECTIONS",
      "apiVersion": "2018-07-01-preview",
      "name": "[parameters('azureblob_1_Connection_Name')]",
      "location": "[parameters('logicAppLocation')]",
      "properties": {
        "api": {
          "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'azureblob')]"
        },
        "displayName": "[parameters('azureblob_1_Connection_DisplayName')]",
        "parameterValues": {
          "accountName": "[parameters('azureblob_1_accountName')]",
          "accessKey": "[parameters('azureblob_1_accessKey')]"
        }
      }
    }
  ],
  "outputs": {}
}

Now set these parameters values in your Environment specific Parameter files:

9.png

Image 9.

Same way, set values in QA and Production parameter files.

First part of Article is complete. Now follow second part ie: Azure DevOps.

So hoping you have your Azure Account ready.

# Second Part:

Now Open https://dev.azure.com/

Login with your credentials.

Here under your Organization Create a New Project:

10.png

Image 10.

From Azure Repos Copy Azure Repos URL.

Step to commit your code into Azure DevOps Repo:

Go to your Visual Studio Logic Apps Code location.

Here in Address bar type cmd.exe

Enter

Command prompt will open. Now execute below command:

git init 

git add .

git commit -am "LogicAppCI/CD_Demo"

git remote add origin AzureRepoURL

git push -u origin –all

It will commit all your code into Azure Git Repos:

Now Check:

11.png

Image 11.

Now time to create Pipeline So click on Build Pipeline:

12.png

Image 12.

Design your Build Pipeline as below:

13.png

Image 13.

14.png

Image 14.

15.png

Image 15.

16.png

Image 16.

17.png

Image 17.

18.png

Image 18.

19.png

Image 19.

20.png

Image 20.

 

Now time to design Release Pipeline:

Click on Release option under Pipeline.

21.png

Image 21.

Now add a Stage: Dev

22.png

Image 22.

23.png

Image 23.

24.png

Image 24.

Now trigger your release pipeline.

25.png

Image 25.

26.png

Image 26.

  Comment:
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us