DEV Community

Kenichiro Nakamura
Kenichiro Nakamura

Posted on

Quickly provision Logic App environment to start developing the flow

This is the Dec 20th article of
Power Automate advent calendar 2022, and I decided to explain how to provision Logic App environment by using bicep.

Main audience for this article is citizen developers who are familiar with Power Automate (and Power Platform solutions).

Difference between Power Automate and Logic App

The most important difference, at least for me, is that Power Automate is owned by user, whereas Logic App belongs to Azure resource. If the flow you are developing is part of backend system, then the owner of the flow obviously shouldn't be user(s).

The good news is that if you can develop Power Automate, you can do so with Logic App, as there are quite similar.

Environment difference

Power Automate is run in Power Platform, whereas Logic App runs in Azure subscription. Therefore, you need to have Azure subscription and appropriate access to the subscription.

You can start using Azure for free if don't have any yet. See Build in the cloud with an Azure free account for more detail.

How to provision Logic App

There are several ways to create Logic App.

  • Azure Portal
  • Azure CLI/Azure PowerShell Module
  • ARM/bicep template

Interesting part of Logic App deployment is that we can include workflow definition itself. However, I want to provision new environment to start development, I explain how to provision environment without any definition.

Azure CLI

Firstly, I explain how to use az command only to create a Logic App.

1. Install logic az cli extension.

az extension add --name logic
Enter fullscreen mode Exit fullscreen mode

2. Create resource group where you provision Logic App. Change name and location as you need.

az group create --name <your resource group name> --location eastus
Enter fullscreen mode Exit fullscreen mode

3. Create definition json as definition.json.

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json",
        "contentVersion": "1.0.0.0",
        "parameters": {},
        "triggers": {},
        "actions": {}
    }
}
Enter fullscreen mode Exit fullscreen mode

4. Run the command to create Logic App.

az logic workflow create -g "<your resource group name>" -l "eastus" --name "testLogicApp" --definition ".\definition.json"
Enter fullscreen mode Exit fullscreen mode

Bicep

Secondly, using bicep.

1. Create logicapp.bicep as below.

@description('The name of the logic app to create.')
param logicAppName string

@description('Location for all resources.')
param location string = resourceGroup().location

var workflowSchema = 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#'

resource stg 'Microsoft.Logic/workflows@2019-05-01' = {
  name: logicAppName
  location: location
  tags: {
    displayName: logicAppName
  }
  properties: {
    definition: {
      '$schema': workflowSchema
      contentVersion: '1.0.0.0'
      parameters: {
      }
      triggers: {
      }
      actions: {
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

2. Run the command.

az deployment group create -g "<your resource group name>" --template-file .\logicapp.bicep --parameters logicAppName=testLogicApp2
Enter fullscreen mode Exit fullscreen mode

Result

In both cases, you can find created Logic Apps in Portal.

Azure Portal Logic Apps

When you open either one, you can see Logic App Designer page.

Logic App Designer

What's next?

As you can see, the definition body is blank. If you want to recreate same or similar workflow, try to convert your flow into definition, then you can easily deploy to different environment.

Top comments (0)