18

In my file

LogicApp.parameters.json

I've declared the extra parameter called MyFirstNewParameter

full file contents below

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "logicAppName": {
      "value": "MyFirstLogicAppOne"
    },
    "servicebus_1_connectionString": {
      "value": "Endpoint=sb://notForYouToSee"
    },
    "MyFirstNewParameter": {
      "value": "abc123"
    }
  }
}

In my LogicApp.json file, I've added the "declaration" of MyFirstNewParameter.

in the

"parameters": {}

area (4th line below is where that section starts)

And I've also added a simple response that tries to read the parameter value and send it back in the response. (Named "Read_And_Use_Parameter_Value_Simple_Response" of all things)

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "logicAppName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "metadata": {
        "description": "Name of the Logic App."
      }
    },
    "logicAppLocation": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "allowedValues": [
        "eastasia",
        "southeastasia",
        "centralus",
        "eastus",
        "eastus2",
        "westus",
        "northcentralus",
        "southcentralus",
        "northeurope",
        "westeurope",
        "japanwest",
        "japaneast",
        "brazilsouth",
        "australiaeast",
        "australiasoutheast",
        "southindia",
        "centralindia",
        "westindia",
        "canadacentral",
        "canadaeast",
        "uksouth",
        "ukwest",
        "westcentralus",
        "westus2",
        "[resourceGroup().location]"
      ],
      "metadata": {
        "description": "Location of the Logic App."
      }
    },
    "MyFirstNewParameter": {
      "type": "string",
      "metadata": {
        "description": "Name of the MyFirstNewParameter."
      },
      "defaultValue": "My1NewParameterDefaultValue"
    }
  },
  "variables": {},
  "resources": [
    {
      "name": "[parameters('logicAppName')]",
      "type": "Microsoft.Logic/workflows",
      "location": "[parameters('logicAppLocation')]",
      "tags": {
        "displayName": "LogicApp"
      },
      "apiVersion": "2016-06-01",
      "properties": {
        "definition": {
          "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
          "actions": {
            "Read_And_Use_Parameter_Value_Simple_Response": {
              "type": "Response",
              "inputs": {
                "statusCode": 200,
                "body": "The parameter value is ***@{parameters('MyFirstNewParameter')}***"
              },
              "runAfter": {}
            }
          },
          "parameters": {},
          "triggers": {
            "manual": {
              "type": "Request",
              "kind": "Http",
              "inputs": {
                "schema": {}
              }
            }
          },
          "contentVersion": "1.0.0.0",
          "outputs": {}
        },
        "parameters": {}
      }
    }
  ],
  "outputs": {}
}

enter image description here

When I sent a request I get the below in the client:

{
    "error": {
        "code": "NoResponse",
        "message": "The server did not received a response from an upstream server. Request tracking id '000000000000000000000'."
    }
}

When I check the portal, the following error is generated:

InvalidTemplate. Unable to process template language expressions in action 'Read_And_Use_Parameter_Value_Simple_Response' inputs at line '1' and column '1232': 'The workflow parameter 'MyFirstNewParameter' is not found.'.

Do what?

How do I "read" parameters defined in LogicApp.parameters.json in the Logic App?

Urls of interest

https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language#parameters

APPEND WITH WORKING CORRECTLY CODE

The accepted answer shows there is ambiguity with the sets of parameters.

Here is the corrected working answer with un-ambiguous names.

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "logicAppName": {
      "value": "MylogicAppName"
    },
    "MyFirstNewArmParameter": {
      "value": "ValueIWantToSeeShowUp"
    }
  }
}

and

   {
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "logicAppName": {
        "type": "string",
        "minLength": 1,
        "maxLength": 80,
        "metadata": {
          "description": "Name of the Logic App."
        }
      },
      "logicAppLocation": {
        "type": "string",
        "defaultValue": "[resourceGroup().location]",
        "allowedValues": [
          "eastasia",
          "southeastasia",
          "centralus",
          "eastus",
          "eastus2",
          "westus",
          "northcentralus",
          "southcentralus",
          "northeurope",
          "westeurope",
          "japanwest",
          "japaneast",
          "brazilsouth",
          "australiaeast",
          "australiasoutheast",
          "southindia",
          "centralindia",
          "westindia",
          "canadacentral",
          "canadaeast",
          "uksouth",
          "ukwest",
          "westcentralus",
          "westus2",
          "[resourceGroup().location]"
        ],
        "metadata": {
          "description": "Location of the Logic App."
        }
      },
      "MyFirstNewArmParameter": {
        "type": "string",
        "metadata": {
          "description": "Name of the MyFirstNewArmParameter."
        },
        "defaultValue": "My1NewArmParameterDefaultValue"
      }
    },
    "variables": {

    },
    "resources": [{
        "name": "[parameters('logicAppName')]",
        "type": "Microsoft.Logic/workflows",
        "location": "[parameters('logicAppLocation')]",
        "tags": {
            "displayName": "LogicApp"
        },
        "apiVersion": "2016-06-01",
        "properties": {
            "definition": {
                "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                "actions": {
                    "Read_And_Use_Parameter_Value_Simple_Response": {
                        "type": "Response",
                      "inputs": {
                        "statusCode": 200,
                        "body": "The parameter value is ***@{parameters('MyFirstNewLogicAppParameter')}***"
                      },
                        "runAfter": {

                        }
                    }
                },
              "parameters": {
                "MyFirstNewLogicAppParameter": {
                  "type": "string",
                  "defaultValue": "MyFirstNewLogicAppParameterDefaultValue"
                }
              },
                "triggers": {
                    "manual": {
                        "type": "Request",
                        "kind": "Http",
                        "inputs": {
                            "schema": {

                            }
                        }
                    }
                },
                "contentVersion": "1.0.0.0",
                "outputs": {

                }
            },
            "parameters": {
              "MyFirstNewLogicAppParameter": {
                "value": "[parameters('MyFirstNewArmParameter')]"
              }
            }
        }
    }],
    "outputs": {

    }
}

The client now receives the anticipated value

**The parameter value is ***ValueIWantToSeeShowUp*****

I also found this article:

http://blog.ibiz-solutions.se/integration/logic-apps-parameters-vs-arm-parameters/

The first paragraph of the articles is below, in case the url stops working in the future (to maybe internet-search if it gets moved)

Logic Apps Parameters vs ARM Parameters I got the question about what the difference is between ARM template parameters and Logic App parameters and when these should be used, so that is what I’ll try to explain in this post. First of ARM template paramters are used with ARM templates and the ARM template is used when deploying ARM based resources to Azure and Logic App’s is a resource that is deployed via ARM templates. The workflow definition language behind Logic App’s is very similar to ARM templates and therefore it can be tricky to see the difference in the beginning.

Author: Mattias Lögdberg

dreftymac
  • 31,404
  • 26
  • 119
  • 182
granadaCoder
  • 26,328
  • 10
  • 113
  • 146
  • For future readers.....check this explanation of arm vs logic app parameterss : http://blog.ibiz-solutions.se/integration/logic-apps-parameters-vs-arm-parameters/ – granadaCoder Sep 07 '17 at 19:38
  • 1
    link is now broken. luckily, MS has documentation for this now: https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-azure-resource-manager-templates-overview#workflow-definition-and-parameters – TGN12 Mar 24 '23 at 14:25

1 Answers1

18

I know it's very confusing, but there are ARM Template parameters and LogicApp parameters. You just declared the ARM parameter, but missed the LogicApp one. Then you can pass the ARM parameter to the LogicApp parameter.

Try this:

    {
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "logicAppName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "metadata": {
                "description": "Name of the Logic App."
            }
        },
        "logicAppLocation": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "allowedValues": ["eastasia",
            "southeastasia",
            "centralus",
            "eastus",
            "eastus2",
            "westus",
            "northcentralus",
            "southcentralus",
            "northeurope",
            "westeurope",
            "japanwest",
            "japaneast",
            "brazilsouth",
            "australiaeast",
            "australiasoutheast",
            "southindia",
            "centralindia",
            "westindia",
            "canadacentral",
            "canadaeast",
            "uksouth",
            "ukwest",
            "westcentralus",
            "westus2",
            "[resourceGroup().location]"],
            "metadata": {
                "description": "Location of the Logic App."
            }
        },
        "MyFirstNewParameter": {
            "type": "string",
            "metadata": {
                "description": "Name of the MyFirstNewParameter."
            },
            "defaultValue": "My1NewParameterDefaultValue"
        }
    },
    "variables": {

    },
    "resources": [{
        "name": "[parameters('logicAppName')]",
        "type": "Microsoft.Logic/workflows",
        "location": "[parameters('logicAppLocation')]",
        "tags": {
            "displayName": "LogicApp"
        },
        "apiVersion": "2016-06-01",
        "properties": {
            "definition": {
                "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                "actions": {
                    "Read_And_Use_Parameter_Value_Simple_Response": {
                        "type": "Response",
                        "inputs": {
                            "statusCode": 200,
                            "body": "The parameter value is ***@{parameters('MyFirstNewParameter')}***"
                        },
                        "runAfter": {

                        }
                    }
                },
                "parameters": {
                    "MyFirstNewParameter": {
                        "type": "string"
                    }
                },
                "triggers": {
                    "manual": {
                        "type": "Request",
                        "kind": "Http",
                        "inputs": {
                            "schema": {

                            }
                        }
                    }
                },
                "contentVersion": "1.0.0.0",
                "outputs": {

                }
            },
            "parameters": {
                "MyFirstNewParameter": {
                    "value": "[parameters('MyFirstNewParameter')]"
                }
            }
        }
    }],
    "outputs": {

    }
}

Some tips and tricks on how to prepare Logic Apps for CI/CD using ARM Templates and parameters in this link: https://platform.deloitte.com.au/articles/preparing-azure-logic-apps-for-cicd

HTH

Paco de la Cruz
  • 2,066
  • 13
  • 22
  • 1
    Gaaaaaaaaaaaaaaaaaaaaaaaaaaa. That is nuts. So the file called "LogicApp.parameters.json" is not for logic app parameters, it is for arm parameters. Geeze Louise. I'm gonna post a new example as an append to my question (I'll make this as the answer). One issue and one suggestion. (in next comments) – granadaCoder Sep 07 '17 at 17:55
  • The syntax for the "arm-to-logic-app parameter jump" is off a tad. Note the lack of "@" in the below code. Since there is ambiguity with the names, i changed the names slightly. "parameters": { "MyFirstNewLogicAppParameter": { "value": "[parameters('MyFirstNewArmParameter')]" } – granadaCoder Sep 07 '17 at 17:57
  • 2
    I've appending my question with full working unambiguous code. If you get chance (Paco), you might fix that last syntax issue "value": "[@parameters('MyFirstNewParameter')]" Thanks for getting me past this hurdle. – granadaCoder Sep 07 '17 at 18:07
  • So now I'm wondering......the parameter that I'm actually storing is the container-name of my blob storage. Should I store that in the arm-parameters or the "other" parameters? – granadaCoder Sep 07 '17 at 18:42
  • 1
    Good pick up @granadaCoder, I just fixed it. Regarding your last question, it really depends. If you want to use ARM parameters for deploying to different environments, the cleanest way to do it is what we've done, i.e., passing ARM parameters to LogicApp parameters. Otherwise, mixing ARM syntax with LogicApps syntax is very messy, IMO. HTH – Paco de la Cruz Sep 07 '17 at 23:20
  • Thanks. Yeah, deployment parameters are are main concern. #notIntuitive The multiple ambiguous "parameters" json is nerve racking. Thanks for getting me unstuck. – granadaCoder Sep 08 '17 at 12:37
  • can you set defaults for `variables` within the variables section in the `logicapp.json` file? – Alex Gordon Jun 20 '19 at 21:42
  • What's your use case for having default values for variables @l--''''''---------''''''''''''? – Paco de la Cruz Jun 24 '19 at 01:26
  • here's the use case https://stackoverflow.com/questions/56693978/when-converting-parameters-to-variables-connections-are-broken-at-dev-time – Alex Gordon Jun 24 '19 at 13:50
  • @l--''''''---------'''''''''''', You can certainly set fixed values in your variables. You can also implement conditions and based on that condition, set your variable value using a static value. HTH. – Paco de la Cruz Jun 27 '19 at 23:34