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.json, parameters.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:
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.
Pipeline Creation
To create a new pipeline, go to Pipelines > “New Pipeline”
Select where your code is:
Select the “Starter Pipeline”:
Give it a name and "Save" it:
Pipeline Configuration
Open your Pipeline YAML file and on a new line, search for “Azure CLI” in the Tasks bar.
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
|
The final pipeline should have the AzureCLI task like so:
- 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.
Now we “Validate and save” the pipeline:
“Run” the pipeline:
The job has succeeded:
The list of workflows has been updated, and the original workflow still exists.
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