Deploy Workflows to Logic App Standard using AZ CLI Task in DevOps Pipeline with Append Option
Published Mar 25 2024 11:52 PM 1,273 Views
Microsoft

Scenario

 

The zipDeploy method used for Deploying Logic Apps Standard overwrites all/any existing files in the wwwroot folder. Set up DevOps for Standard logic apps - Azure Logic Apps | Microsoft Learn

This tutorial is for using an Azure CLI task instead of the zipDeploy task, to give you flexibility on whether to overwrite the files/folder or not.

 

Services Used

  • Azure Devops
  • Azure CLI
  • Logic Apps Standard

 

Artifacts Folder Configuration

 

Create the zip file with that contains your workflow folders, and any other files that need to modified, like host.json or connections.json, in the following structure.

 

Note: If you're including the connections.jsonparameters.json and host.json, in the zip file, please ensure to include the content for the already existing workflows and existing settings, as these files will get completely overwritten:

 

artifacts.zip

| Workflow1-Folder

| workflow.json

| Workflow2-Folder

| workflow.json

| connections.json

 

| parameters.json

 

| host.json

 

 

Sample:

 

KalyaniD_0-1710436480717.png

 

 

Upload the Artifacts to DevOps

 

In the Repos sections of DevOps, select “Upload file(s)” and upload the artifacts.zip file containing the workflow folders, and any other files that will be uploaded to the wwwroot directory of the Logic App.

 

KalyaniD_1-1710436660830.png

 

Pipeline Creation

 

To create a new pipeline, go to Pipelines > “New Pipeline”

 

KalyaniD_2-1710436683383.png

 

 

Select where your code is:

 

KalyaniD_3-1710436683385.png

 

 

Select the “Starter Pipeline”:

 

KalyaniD_4-1710436683389.png

 

 

Give it a name and "Save" it:

 

KalyaniD_5-1710436683392.png

 

 

Pipeline Configuration

 

Open your Pipeline YAML file and on a new line, search for “Azure CLI” in the Tasks bar. 

 

KalyaniD_6-1710436683397.png

 

 

Fill out the following information in the Azure CLI Task prompt and click “Add”.

 

Azure Resource Manager connection

<subscription reference>

Script Type

Shell

Script Location

Inline script

Inline Script

az webapp deploy --resource-group ResourceGroupName --name LogicAppName --src-path artifacts.zip --type=zip --clean false

 

 

KalyaniD_7-1710436683398.png

 

 

 

 

The final pipeline should have the AzureCLI task like so:

 

KalyaniD_8-1710436683400.png

 

 

- task: AzureCLI@2

  inputs:

    azureSubscription: 'subscription reference'

    scriptType: 'bash'

    scriptLocation: 'inlineScript'

    inlineScript: 'az webapp deploy --resource-group ResourceGroupName --name LogicAppName --src-path artifacts.zip --type=zip --clean false'

 

Pipeline Deployment

 

Before running the pipeline, I have created an existing workflow in my Logic App.

 

KalyaniD_9-1710436683403.png

 

 

Now we “Validate and save” the pipeline:

 

KalyaniD_10-1710436683405.png

 

 

KalyaniD_11-1710436683408.png

 

 

“Run” the pipeline:

 

KalyaniD_12-1710436683410.png

 

KalyaniD_13-1710436683412.png

 

 

The job has succeeded:

 

KalyaniD_14-1710436683416.png

 

 

The list of workflows has been updated, and the original workflow still exists.

 

KalyaniD_15-1710436683419.png

 

References

DevOps Deploy Task: Set up DevOps for Standard logic apps - Azure Logic Apps | Microsoft Learn

Deploy Az WebApp Command: Deploy files to App Service - Azure App Service | Microsoft Learn

ZipDeploy Details: AzureFunctionApp@2 - Azure Functions Deploy v2 task | Microsoft Learn

AZ CLI Documentation: az webapp | Microsoft Learn

 

Co-Authors
Version history
Last update:
‎Mar 20 2024 10:02 PM
Updated by: