Quickstart: Create and deploy a Consumption logic app workflow in multi-tenant Azure Logic Apps with Bicep

Applies to: Azure Logic Apps (Consumption)

Azure Logic Apps is a cloud service that helps you create and run automated workflows that integrate data, apps, cloud-based services, and on-premises systems by choosing from hundreds of connectors. This quickstart focuses on the process for deploying a Bicep file to create a basic Consumption logic app workflow that checks the status for Azure on an hourly schedule and runs in multi-tenant Azure Logic Apps.

Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. It provides concise syntax, reliable type safety, and support for code reuse. Bicep offers the best authoring experience for your infrastructure-as-code solutions in Azure.

Prerequisites

If you don't have an Azure subscription, sign up for a trial Azure subscription before you start.

Review the Bicep file

The Bicep file used in this quickstart is from Azure Quickstart Templates.

The quickstart template creates a Consumption logic app workflow that uses the built-in Recurrence trigger, which is set to run every hour, and a built-in HTTP action, which calls a URL that returns the status for Azure. Built-in operations run natively on Azure Logic Apps platform.

This Bicep file creates the following Azure resource:

  • Microsoft.Logic/workflows, which creates the workflow for a logic app.

    @description('The name of the logic app to create.')
    param logicAppName string
    
    @description('A test URI')
    param testUri string = 'https://status.azure.com/en-us/status/'
    
    @description('Location for all resources.')
    param location string = resourceGroup().location
    
    var frequency = 'Hour'
    var interval = '1'
    var type = 'recurrence'
    var actionType = 'http'
    var method = 'GET'
    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: {
             testUri: {
               type: 'string'
               defaultValue: testUri
             }
           }
           triggers: {
             recurrence: {
               type: type
               recurrence: {
                 frequency: frequency
                 interval: interval
               }
             }
           }
           actions: {
             actionType: {
               type: actionType
               inputs: {
                 method: method
                 uri: testUri
               }
             }
           }
         }
       }
    }
    

Deploy the Bicep file

  1. Save the Bicep file as main.bicep to your local computer.

  2. Deploy the Bicep file using either Azure CLI or Azure PowerShell.

    az group create --name exampleRG --location chinaeast
    az deployment group create --resource-group exampleRG --template-file main.bicep --parameters logicAppName=<logic-name>
    

Note

Replace <logic-name> with the name of the logic app to create.

When the deployment finishes, you should see a message indicating the deployment succeeded.

Review deployed resources

Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.

az resource list --resource-group exampleRG

Clean up resources

When you no longer need the logic app, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and its resources.

az group delete --name exampleRG

Next steps