1
votes

We are working on ARM template for scheduling custom workflow using azure logic apps, which has first activity as "Recurrence". Also we are automating deployment of logic apps using ARM template

What will be the best approach to ARM template with parameters for Recurrence, because it has many Frequency and handling all with parameters will have too many parameters exposed in ARM template \ parameter Or what other options available to handle this scenario

1

1 Answers

1
votes

The way I handle this scenario is by fixing the values that my parameter can accept by limiting the allowed values in my parameter collection using the allowed value. Recurrence trigger has four configuration items which are the Frequency, Interval, StartTime and TimeZone these can be fed the values using the arm template parameters. Following is a sample ARM template which deploys a logic app with recurrence trigger. Please observe the parameters as I have locked down the allowed values.

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "workflows_testla1_name": {
        "defaultValue": "testla1",
        "type": "string"
    },
    "param_recurrence_interval": {
        "type":"int",
        "defaultValue": 2,
        "allowedValues": [
            1,
            2,
            3,
            4,
            5,
            6
        ]
    },
    "param_recurrence_frequency": {
        "type": "string",
        "defaultValue": "Minute",
        "allowedValues": [
            "Day",
            "Hour",
            "Minute",
            "Month",
            "Second",
            "Week",
            "Year"
        ]
    },
    "param_recurrence_startTime":{
        "type": "string",
        "allowedValues": [
            "2020-03-14T00:00:00Z"
        ]
    },
    "param_recurrence_timeZone" : {
        "type": "string",
        "defaultValue": "Cen. Australia Standard Time",
        "allowedValues": [
            "Cen. Australia Standard Time"
        ]
    }
},
"resources": [
    {
        "apiVersion": "2017-07-01",
        "dependsOn": [],
        "location": "australiaeast",
        "name": "[parameters('workflows_testla1_name')]",
        "properties": {
            "definition": {
                "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                "contentVersion": "1.0.0.0",
                "parameters": {},
                "triggers": {
                    "Recurrence": {
                        "recurrence": {
                            "frequency": "[parameters('param_recurrence_frequency')]",
                            "interval": "[parameters('param_recurrence_interval')]",
                            "startTime": "[parameters('param_recurrence_startTime')]",
                            "timeZone": "[parameters('param_recurrence_timeZone')]"
                        },
                        "type": "Recurrence"
                    }
                },
                "outputs": {}
            },
            "parameters": {},
            "state": "Enabled"
        },
        "scale": null,
        "tags": {},
        "type": "Microsoft.Logic/workflows"
    }
],
"variables": {}}

The accompanying parameters file looks like following

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "workflows_testla1_name": {
        "value": "testla1"

    },
    "param_recurrence_interval": {
        "value": 3
    },
    "param_recurrence_frequency": {
        "value": "Hour"
    },
    "param_recurrence_startTime":{
       "value": "2020-03-14T00:00:00Z"
    },
    "param_recurrence_timeZone" : {
      "value": "Cen. Australia Standard Time"
    }
}}