- Print
- DarkLight
- PDF
Deploy Azure Logic App using Bicep Language
- Print
- DarkLight
- PDF
The purpose of this article is to help you deploy an Azure Logic App in your environment using Infrastructure-as-Code with Azure Bicep.
Azure Bicep is a domain-specific language (DSL) that uses a declarative syntax to deploy Azure resources.
Bicep is an abstraction on top of Azure Resource Manager (ARM) templates to define Azure resources using declarative Infrastructure as Code.
This article will show how you can deploy an Azure Logic App using Azure Bicep, a Domain Specific Language (DSL) for deploying Azure resources declaratively.
Prerequisites
• An Active Azure account: You can create an account for free.
• Azure Bicep is installed on your local machine.
• Azure PowerShell. See: Install Azure PowerShell.
• A resource group in your Azure subscription
Let’s get started!
Solution Overview
We will author a Bicep template that creates an Azure Logic App.
The solution will include the following files:
• 📄 main.bicep: This is the Bicep template
• 📄 azuredeploy.parameters.json: This parameter file contains the values to use for deploying your Bicep template.
2. Azure Bicep Template — parameters
Create a new file in your working directory and name it main.bicep . We will define the following parameters:
@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
- Azure Bicep Template — variables
We will define the following variables:
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#'
4. Azure Bicep Template — resources
We will define the following resource:
resource logicApp '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
}
}
}
}
}
}
5. Parameters file
Create a new file named azuredeploy.parameters.json. The code below shows the definition of the parameters file:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"value": "azinsider-logicapp"
}
}
}
6. Azure Bicep Template — Deployment
We will use the command below to deploy our Bicep template:
$date = Get-Date -Format "MM-dd-yyyy"
$rand = Get-Random -Maximum 1000
$deploymentName = "AzInsiderDeployment-"+"$date"+"-"+"$rand"
New-AzResourceGroupDeployment -Name $deploymentName -ResourceGroupName azinsider_demo -TemplateFile .\main.bicep -TemplateParameterFile .\azuredeploy.parameters.json -c
The image below shows the preview of the deployment:
Then we will execute the deployment. The image below shows the deployment output:
You can also verify the deployment using the Azure Portal:
Source Code
You can find the code of this solution in the following URL, feel free to contribute!
https://github.com/daveRendon/azinsider/tree/main/application-workloads/azure-logic-app