skip to Main Content

We have been searching for tutorials on how to deploy an Azure Logic App (Consumption Plan) to Azure Cloud using a DevOps pipeline and have even found some posts similar to this question here on Stack, but there doesn’t seem to be a straightforward way to do this.

We originally developed the Logic App directly in Azure Portal are hoping we can download the Logic App from Azure Cloud and modify on a development machine, check into DevOps and deploy back up to the Azure Cloud.

To test this we created a new Azure Resource Group project in Visual Studio 2019 project.

enter image description here

And chose Logic App:
enter image description here

At this point we have a new solution with 3 files

  1. Deploy-AzureResourceGroup.ps1
  2. LogicApp.json
  3. LogicApp.parameters.json

enter image description here

Since we already have developed the Logic App in Azure Cloud, the thought was to download the finished Logic App and add/replace (existing file) to/in this solution however the downloaded file isn’t split into 2 files IE: LogicApp.parameters.json and LogicApp.json and is named something else IE: testLogicApp.json.

enter image description here

We’re not sure if the downloaded file (testLogicApp.json) needs to modified/renamed and split into a LogicApp.parameters.json file and a LogicApp.json file replacing the existing 2 files.

The next issue we’re facing is how to deploy the Logic App using DevOps.

There seem to be at least 2 options for this which are:

  1. Use the existing Deploy-AzureResourceGroup.ps1
  2. Use an ARM Template

But details regarding implementing these 2 possible solutions seem to be difficult to find so we’re wondering if anyone might be able to assist. if they’ve been through this process before.

Thanks in advance.

2

Answers


  1. I usually use this extractor, works great, installation is easy through PS-Gallery

    https://github.com/jeffhollan/LogicAppTemplateCreator

    you can run:

     Get-LogicAppTemplate -LogicApp MyApp -ResourceGroup myRg2023 -SubscriptionId 23d4ee89-xxxx-4bd3-a718-0050f2c8ab03 -Verbose | Out-File C:template.json
    

    and to get a separate param file:

    Get-ParameterTemplate -TemplateFile $filenname | Out-File 'paramfile.json'
    
    Login or Signup to reply.
  2. Method 1 – Azure Portal

    1. Create the Logic App via the Portal Designer (I believe you have this step done)
    2. Take note of any API connections that have been created during your development, these can be found:API Connections
    3. Once you have tested your Logic App in Dev and is working as expected, you can now work on the ARM Template. Here is how you can easily export your resources: Export Resources to ARM Template
    4. Depending on your Logic App, at this point you may need to add some additional parameters like subscriptionID or resourceGroupName so that those can be set via the ARM Template Deployments. Once you believe your ARM template is good to go (should only require minor tweaks), then you can click the "Add to library" button at the top of Export window and choose where the Template Spec will reside Add to Library
    5. You now have an ARM Template Deployment Library that can be used to deploy to any environment you wish (if you have the privileges), just navigate to the Template Spec at the Resource Group you saved it to. Then click "Deploy", this will bring up the Subscription, ResourceGroup, Region, and Parameters to deploy. ARM Template Deployment

    **Note: This is really not specific to Logic Apps and can work with almost ANY Azure resource. You can alternatively use Azure DevOps or Git to do any ARM template deployments to an Azure resource group.You just need your ARM Template JSON file in the Repository and you can set your Parameter override values in the release pipeline.

    Method 2 – Azure DevOps

    *Note- I am making the assumption you are using Visual Studio to develop your Logic App and Code, which is also integrated with Azure DevOps (or Git).

    1. Make sure your ARM template and parameters file are pushed to Azure DevOps or Git from your local Visual Studio Repo. (So that both files are available in your Remote Repo) ARM JSON Files

    2. Use these files as an Artifact in your Release Pipeline Repo Artifact

    3. The next step is to create your ARM Template Deployment Task and set the file paths from the artifact and fill out the override parameters. This is where you will specify where is the ARM Template deployment deploying to (Subscription, Resource Group, Location, etc) and what parameter values to use: Deployment Task This particular example is using Classic Pipeline editor, but here is the yaml for the task:

      steps:
      - task: AzureResourceManagerTemplateDeployment@3
       displayName: 'ARM Template deployment: Resource Group scope'
       inputs:
         azureResourceManagerConnection: 'SubsName (XXXX)'
         subscriptionId: 'XXXXXXXX'
         resourceGroupName: 'XXXXXXX'
         location: 'South Central US'
         csmFile: '$(System.DefaultWorkingDirectory)/_EDW-AzureResources/EDWResources/ADFErrorPollingLogicApp-template.json'
      csmParametersFile: '$(System.DefaultWorkingDirectory)/_EDW-AzureResources/EDWResources/ADFErrorPollingLogicApp-parameters.json'
      overrideParameters: '-workflows_adffailure_logic_app_name "logic-ccok-XXXX" -workflows_teamspost_logic_app_name "logic-ccok-XXXX" -environment "dev" -app_name "EDW" -teamsName "EDW-XXXXX" -teamsChannelName "ADF-DEVXXXX" -dataFactoryName "adf-cXXXX"'
      
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search